1 // RUN: %clang_cc1 -fsyntax-only -Wunused -Wused-but-marked-unused -std=c++17 -Wc++17-extensions -verify %s
2 // RUN: %clang_cc1 -fsyntax-only -Wunused -Wused-but-marked-unused -std=c++11 -Wc++17-extensions -verify -DEXT %s
4 static_assert(__has_cpp_attribute(maybe_unused
) == 201603, "");
6 struct [[maybe_unused
]] S
{};
9 EnumVal
[[maybe_unused
]],
14 int x
; // expected-warning {{unused variable}}
15 typedef int I
; // expected-warning {{unused typedef 'I'}}
17 switch (e
) { // expected-warning {{enumeration value 'UsedEnumVal' not handled in switch}}
20 // Should not warn about these due to not being used.
21 [[maybe_unused
]] int y
;
22 typedef int maybe_unused_int
[[maybe_unused
]];
24 // Should not warn about these uses.
26 maybe_unused_int test
;
35 // expected-warning@6 {{use of the 'maybe_unused' attribute is a C++17 extension}}
36 // expected-warning@9 {{use of the 'maybe_unused' attribute is a C++17 extension}}
37 // expected-warning@9 {{attributes on an enumerator declaration are a C++17 extension}}
38 // expected-warning@21 {{use of the 'maybe_unused' attribute is a C++17 extension}}
39 // expected-warning@22 {{use of the 'maybe_unused' attribute is a C++17 extension}}