aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp23/init-stmt1.C
blob: 29e3256aae62b6989bf70f9ebcb6ae4c37c4a7fc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// PR c++/102617
// P2360R0: Extend init-statement to allow alias-declaration
// { dg-do compile { target c++20 } }
// Test valid use.

int v[10];

void
g ()
{
  for (using T = int; (T) false;) // { dg-error "only available with" "" { target c++20_only } }
    ;
  for (using T = int; T e : v) // { dg-error "only available with" "" { target c++20_only } }
    (void) e;
  if (using T = int; true) // { dg-error "only available with" "" { target c++20_only } }
    {
      T x = 0;
      (void) x;
    }
  if constexpr (using T = int; true) // { dg-error "only available with" "" { target c++20_only } }
    {
      T x = 0;
      (void) x;
    }
  switch (using T = int; 42) // { dg-error "only available with" "" { target c++20_only } }
    case 42:
      {
	T x = 0;
	(void) x;
      }
}