Debian Codegraph @

gcc/testsuite/g++.dg/cpp26/name-independent-decl7.C

raw
1 // P2169R4 - A nice placeholder with no name
2 // { dg-do compile { target c++11 } }
3 // { dg-options "-Wunused-variable -Wunused-but-set-variable -Wunused-parameter -Wshadow" }
4
5 int bar ();
6
7 void
8 baz ()
9 {
10 for (; int _ = bar (); ++_)
11 int _ = 1; // { dg-warning "name-independent declarations only available with" "" { target c++23_down } }
12 for (int _ = bar ();
13 int _ = bar (); ) // { dg-warning "name-independent declarations only available with" "" { target c++23_down } }
14 int _ = 2; // { dg-warning "name-independent declarations only available with" "" { target c++23_down } }
15 for (int _ = bar ();
16 int _ = bar (); ) // { dg-warning "name-independent declarations only available with" "" { target c++23_down } }
17 ;
18 for (; int _ = bar (); ++_)
19 {
20 int _ = 3; // { dg-warning "name-independent declarations only available with" "" { target c++23_down } }
21 }
22 for (int _ = bar ();
23 int _ = bar (); ) // { dg-warning "name-independent declarations only available with" "" { target c++23_down } }
24 {
25 int _ = 4; // { dg-warning "name-independent declarations only available with" "" { target c++23_down } }
26 }
27 }