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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [g++.dg/] [ext/] [anon-struct1.C] - Blame information for rev 693

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 693 jeremybenn
/* { dg-options "-ansi -pedantic -pedantic-errors" } */
2
/* In strict ISO C++ mode, we don't recognize the anonymous struct
3
   extension or any Microsoft C extensions.  */
4
 
5
struct A { char a; };
6
 
7
struct B {
8
  struct A;                     /* forward decl of B::A.  */
9
  char b;
10
};
11
char testB[sizeof(B) == sizeof(A) ? 1 : -1];
12
 
13
struct C {
14
  struct D { char d; };         /* decl of C::D.  */
15
  char c;
16
};
17
char testC[sizeof(C) == sizeof(A) ? 1 : -1];
18
char testD[sizeof(C::D) == sizeof(A) ? 1 : -1];
19
 
20
/* GNU extension.  */
21
struct E {
22
  struct { char z; };           /* { dg-error "prohibits anonymous structs" } */
23
  char e;
24
};
25
 
26
typedef struct A typedef_A;
27
struct F {
28
  typedef_A;                    /* { dg-error "does not declare anything" } */
29
  char f;
30
};
31
char testF[sizeof(struct F) == sizeof(struct A) ? 1 : -1];
32
 
33
/* __extension__ enables GNU C mode for the duration of the declaration.  */
34
__extension__ struct G {
35
  struct { char z; };
36
  char g;
37
};
38
char testG[sizeof(G) == 2 * sizeof(A) ? 1 : -1];
39
 
40
struct H {
41
  __extension__ struct { char z; };
42
  char h;
43
};
44
char testH[sizeof(H) == 2 * sizeof(A) ? 1 : -1];
45
 
46
/* Make sure __extension__ gets turned back off.  */
47
struct I {
48
  struct { char z; };           /* { dg-error "prohibits anonymous structs" } */
49
  char i;
50
};

powered by: WebSVN 2.1.0

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