• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // RUN: %clang_cc1 -fsyntax-only -Wunused -std=c++1z -verify %s
2 
3 struct [[maybe_unused]] S {
4   int I [[maybe_unused]];
5   static int SI [[maybe_unused]]; // expected-warning {{'maybe_unused' attribute only applies to variables, functions, methods, types, enumerations, enumerators, labels, and non-static data members}}
6 };
7 
8 enum [[maybe_unused]] E1 {
9   EnumVal [[maybe_unused]]
10 };
11 
unused_func(int parm)12 [[maybe_unused]] void unused_func([[maybe_unused]] int parm) {
13   typedef int maybe_unused_int [[maybe_unused]];
14   [[maybe_unused]] int I;
15 }
16 
17 namespace [[maybe_unused]] N {} // expected-warning {{'maybe_unused' attribute only applies to}}
18