aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/gnu2x-auto-1.c
blob: e0b9e867d6ec5e97d52afd84ffb3ce45912a201e (plain)
1
2
3
4
5
6
7
8
9
10
11
/* Test C2x auto.  Invalid code with GNU extensions.  */
/* { dg-do compile } */
/* { dg-options "-std=gnu2x" } */

void
f ()
{
  /* Do not allow a non-definition declaration of a tag in the auto
     initializer, to avoid it escaping an inner scope as shown here.  */
  auto x = ({ struct s; struct s *x = 0; x; }); /* { dg-error "declared in underspecified object initializer" } */
}