Debian Codegraph @

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

raw
1 // P2169R4 - A nice placeholder with no name
2 // { dg-do compile { target c++11 } }
3 // { dg-options "" }
4
5 int bar ();
6
7 void
8 baz ()
9 {
10 for (int _ = bar ();
11 int _ = bar (); ++_) // { dg-warning "name-independent declarations only available with" "" { target c++23_down } }
12 ; // { dg-error "reference to '_' is ambiguous" "" { target *-*-* } .-1 }
13 for (; int _ = bar (); ++_)
14 {
15 int _ = 3; // { dg-warning "name-independent declarations only available with" "" { target c++23_down } }
16 ++_; // { dg-error "reference to '_' is ambiguous" }
17 }
18 for (int _ = bar ();
19 int _ = bar (); ) // { dg-warning "name-independent declarations only available with" "" { target c++23_down } }
20 {
21 int _ = 4; // { dg-warning "name-independent declarations only available with" "" { target c++23_down } }
22 ++_; // { dg-error "reference to '_' is ambiguous" }
23 }
24 }