bolt/deps/llvm-18.1.8/clang/test/CXX/dcl.dcl/dcl.attr/dcl.attr.nodiscard/p1.cpp

11 lines
410 B
C++
Raw Normal View History

2025-02-14 19:21:04 +01:00
// RUN: %clang_cc1 -fsyntax-only -std=c++2a -verify %s
struct [[nodiscard]] S1 {}; // ok
struct [[nodiscard, nodiscard]] S2 {}; // ok
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, function pointers, and typedefs}}