11 lines
492 B
C++
11 lines
492 B
C++
// RUN: %clang_cc1 -fsyntax-only -std=c++2a -verify %s
|
|
|
|
struct [[nodiscard]] S1 {}; // ok
|
|
struct [[nodiscard nodiscard]] S2 {}; // expected-error {{attribute 'nodiscard' cannot appear multiple times in an attribute specifier}}
|
|
struct [[nodiscard("Wrong")]] S3 {};
|
|
|
|
[[nodiscard]] int f();
|
|
enum [[nodiscard]] E {};
|
|
|
|
namespace [[nodiscard]] N {} // expected-warning {{'nodiscard' attribute only applies to Objective-C methods, enums, structs, unions, classes, functions, and function pointers}}
|