OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.dg/] [anon-struct-13.c] - Blame information for rev 701

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 689 jeremybenn
/* { dg-do compile } */
2
/* { dg-options "-fplan9-extensions" } */
3
 
4
/* Test for ambiguity when using the Plan 9 extensions.  */
5
 
6
struct A {
7
  char a;               /* { dg-error "duplicate member" } */
8
};
9
 
10
struct B
11
{
12
  struct A;
13
  struct A;
14
};
15
 
16
char
17
f1 (struct B *p)
18
{
19
  return p->a;          /* { dg-error "no member" } */
20
}
21
 
22
void
23
f2 (struct A *p)        /* { dg-message "expected" } */
24
{
25
}
26
 
27
void
28
f3 (struct B *p)
29
{
30
  f2 (p);               /* { dg-warning "incompatible pointer type" } */
31
}
32
 
33
struct C
34
{
35
  char c;               /* { dg-error "duplicate member" } */
36
};
37
 
38
struct D
39
{
40
  struct C;
41
};
42
 
43
struct E
44
{
45
  struct C;
46
  struct D;
47
};
48
 
49
char
50
f4 (struct E *p)
51
{
52
  return p->c;          /* { dg-error "no member" } */
53
}
54
 
55
void
56
f6 (struct C *p)        /* { dg-message "expected" } */
57
{
58
}
59
 
60
void
61
f7 (struct E *p)
62
{
63
  f6 (p);               /* { dg-warning "incompatible pointer type" } */
64
}
65
 
66
struct A
67
f8 (struct B *p)
68
{
69
  return p->A;          /* { dg-error "no member" } */
70
}
71
 
72
struct C
73
f9 (struct E *p)
74
{
75
  return p->C;          /* { dg-error "no member" } */
76
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.