Debian Codegraph @

gcc/testsuite/g++.dg/warn/Wunused-var-36.C

raw
1 // PR c++/92666
2 // { dg-do compile }
3 // { dg-options "-Wunused-but-set-variable" }
4
5 int bar (int, ...);
6 #if __cplusplus >= 201103L
7 enum class E : int { F = 0, G = 1 };
8 #endif
9 struct S { int s; };
10
11 void
12 foo ()
13 {
14 float r = 1.0f; // { dg-bogus "set but not used" }
15 int i = 2; // { dg-bogus "set but not used" }
16 #if __cplusplus >= 201103L
17 decltype(nullptr) n = nullptr; // { dg-bogus "set but not used" }
18 E e = E::F; // { dg-bogus "set but not used" }
19 #else
20 void *n = (void *) 0;
21 int e = 4;
22 #endif
23 S s = { 3 }; // { dg-bogus "set but not used" }
24 bar (0, r, i, n, e, s);
25 }