(void)get_e();
}
-[[nodiscard nodiscard]] int wrong1(); // expected-error {{attribute 'nodiscard' cannot appear multiple times in an attribute specifier}}
-
-namespace [[nodiscard]] N {} // expected-warning {{'nodiscard' attribute only applies to functions, methods, enums, and classes}}
-
#ifdef EXT
// expected-warning@4 {{use of the 'nodiscard' attribute is a C++1z extension}}
// expected-warning@8 {{use of the 'nodiscard' attribute is a C++1z extension}}
// expected-warning@11 {{use of the 'nodiscard' attribute is a C++1z extension}}
-// expected-warning@25 2{{use of the 'nodiscard' attribute is a C++1z extension}}
#endif
--- /dev/null
+// RUN: %clang_cc1 -std=c++1z -verify %s
+
+namespace std_example {
+ struct [[nodiscard]] error_info{
+ // ...
+ };
+
+ error_info enable_missile_safety_mode();
+ void launch_missiles();
+ void test_missiles() {
+ enable_missile_safety_mode(); // expected-warning {{ignoring return value of function declared with 'nodiscard'}}
+ launch_missiles();
+ }
+
+ error_info &foo();
+ void f() { foo(); } // no warning
+}