Debian Codegraph @

gcc/testsuite/g++.dg/diagnostic/maybe_unused1.C

raw
1 /* [dcl.attr.unused] The attribute may be applied to the declaration of a
2 class, a typedef-name, a variable (including a structured binding
3 declaration), a non-static data member, a function, an enumeration, or an
4 enumerator. */
5 // { dg-do compile { target c++11 } }
6 // { dg-additional-options "-Wunused -Wextra" }
7
8 class [[maybe_unused]] Test {
9 [[maybe_unused]] int a_;
10 void b() {};
11 };
12
13 [[maybe_unused]] typedef Test Test2;
14
15 [[maybe_unused]] int i;
16 [[maybe_unused]] void f();
17 enum [[maybe_unused]] E { e [[maybe_unused]] = 42 };