aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.dg/c11-anon-struct-2.c
blob: d954b4b12703b6f0985627c192ee05bea1d746b5 (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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/* Test for anonymous structures and unions in C11.  Test for invalid
   cases.  */
/* { dg-do compile } */
/* { dg-options "-std=c11 -pedantic-errors" } */

typedef struct s0
{
  int i;
} s0;

struct s1
{
  int a;
  struct s0; /* { dg-error "declaration does not declare anything" } */
};

struct s2
{
  int a;
  s0; /* { dg-error "declaration does not declare anything" } */
};

struct s3
{
  struct
  {
    int i;
  };
  struct
  {
    int i; /* { dg-error "duplicate member" } */
  };
};

struct s4
{
  int a;
  struct s
  {
    int i;
  }; /* { dg-error "declaration does not declare anything" } */
};

struct s5
{
  struct
  {
    int i;
  } a;
  int b;
} x;

void
f (void)
{
  x.i = 0; /* { dg-error "has no member" } */
}