summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/anon-struct-13.c
blob: 6a508141bac547c644dca54688d20d528604d6a5 (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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
/* { dg-do compile } */
/* { dg-options "-fplan9-extensions" } */

/* Test for ambiguity when using the Plan 9 extensions.  */

struct A {
  char a;		/* { dg-error "duplicate member" } */
};

struct B
{
  struct A;
  struct A;
};

char
f1 (struct B *p)
{
  return p->a;		/* { dg-error "no member" } */
}

void
f2 (struct A *p)	/* { dg-message "expected" } */
{
}

void
f3 (struct B *p)
{
  f2 (p);		/* { dg-warning "incompatible pointer type" } */
}

struct C
{
  char c;		/* { dg-error "duplicate member" } */
};

struct D
{
  struct C;
};

struct E
{
  struct C;
  struct D;
};

char
f4 (struct E *p)
{
  return p->c;		/* { dg-error "no member" } */
}

void
f6 (struct C *p)	/* { dg-message "expected" } */
{
}

void
f7 (struct E *p)
{
  f6 (p);		/* { dg-warning "incompatible pointer type" } */
}

struct A
f8 (struct B *p)
{
  return p->A;		/* { dg-error "no member" } */
}

struct C
f9 (struct E *p)
{
  return p->C;		/* { dg-error "no member" } */
}