"nodiscard attribute cannot be applied to types" build failure(s) — clang 8.0.1
clang generates an error, g++ generates a simple warning.int a [[]]; int & [[nodiscard]] b = a;
$ clang++ -std=c++11 -c foo.cpp
foo.cpp:2:9: error: 'nodiscard' attribute cannot be applied to types
int & [[nodiscard]] b = a;
^
1 error generated.
$ g++ -std=c++11 -c foo.cpp
foo.cpp:2:20: warning: attribute ignored [-Wattributes]
int & [[nodiscard]] b = a;
^
foo.cpp:2:20: note: an attribute that appertains to a type-specifier is ignored
This is impacting mostly Qt based packages.No error detected for version 8.0.1