| 1 | // RUN: %clang_cc1 -fsyntax-only -std=c++1z -verify %s |
| 2 | |
| 3 | struct [[nodiscard]] S1 {}; // ok |
| 4 | struct [[nodiscard nodiscard]] S2 {}; // expected-error {{attribute 'nodiscard' cannot appear multiple times in an attribute specifier}} |
| 5 | struct [[nodiscard("Wrong")]] S3 {}; // expected-error {{'nodiscard' cannot have an argument list}} |
| 6 | |
| 7 | [[nodiscard]] int f(); |
| 8 | enum [[nodiscard]] E {}; |
| 9 | |
| 10 | namespace [[nodiscard]] N {} // expected-warning {{'nodiscard' attribute only applies to Objective-C methods, enums, structs, unions, classes, functions, and function pointers}} |
| 11 | |