Clang Project

clang_source_code/test/CXX/dcl.dcl/dcl.attr/dcl.attr.unused/p2.cpp
1// RUN: %clang_cc1 -fsyntax-only -Wunused -std=c++1z -verify %s
2
3struct [[maybe_unused]] S {
4  int I [[maybe_unused]];
5  static int SI [[maybe_unused]];
6};
7
8enum [[maybe_unused]] E1 {
9  EnumVal [[maybe_unused]]
10};
11
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
17namespace [[maybe_unused]] N {} // expected-warning {{'maybe_unused' attribute only applies to}}
18