| 1 |
// PR c++/102617 |
| 2 |
// P2360R0: Extend init-statement to allow alias-declaration |
| 3 |
// { dg-do compile { target c++20 } } |
| 4 |
// Test valid use. |
| 5 |
|
| 6 |
int v[10]; |
| 7 |
|
| 8 |
void |
| 9 |
g () |
| 10 |
{ |
| 11 |
for (using T = int; (T) false;) // { dg-error "only available with" "" { target c++20_only } } |
| 12 |
; |
| 13 |
for (using T = int; T e : v) // { dg-error "only available with" "" { target c++20_only } } |
| 14 |
(void) e; |
| 15 |
if (using T = int; true) // { dg-error "only available with" "" { target c++20_only } } |
| 16 |
{ |
| 17 |
T x = 0; |
| 18 |
(void) x; |
| 19 |
} |
| 20 |
if constexpr (using T = int; true) // { dg-error "only available with" "" { target c++20_only } } |
| 21 |
{ |
| 22 |
T x = 0; |
| 23 |
(void) x; |
| 24 |
} |
| 25 |
switch (using T = int; 42) // { dg-error "only available with" "" { target c++20_only } } |
| 26 |
case 42: |
| 27 |
{ |
| 28 |
T x = 0; |
| 29 |
(void) x; |
| 30 |
} |
| 31 |
} |