Debian Codegraph @

gcc/testsuite/g++.dg/cpp26/decomp29.C

raw
1 // PR c++/122559
2 // { dg-do compile { target c++11 } }
3 // { dg-options "" }
4
5 enum class A : bool { B, C };
6
7 template <typename T>
8 A type (T &&x)
9 {
10 if (auto [value = x ()]) // { dg-warning "structured bindings in conditions only available with" "" { target c++23_down } }
11 return A::C; // { dg-error "expected '\\\]' before '=' token" "" { target *-*-* } .-1 }
12 return A::B; // { dg-error "expected initializer before '\\\)' token" "" { target *-*-* } .-2 }
13 }
14
15 int
16 main ()
17 {
18 auto _ = type (A::B);
19 }