OSDN Git Service
(root)
/
pf3gnuchains
/
gcc-fork.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
gcc/
[pf3gnuchains/gcc-fork.git]
/
gcc
/
testsuite
/
gcc.dg
/
c1x-anon-struct-1.c
1
/* Test for anonymous structures and unions in C1X. */
2
/* { dg-do compile } */
3
/* { dg-options "-std=c1x -pedantic-errors" } */
4
5
#include <stddef.h>
6
7
typedef struct
8
{
9
int i;
10
} s0;
11
12
typedef union
13
{
14
int i;
15
} u0;
16
17
struct s1
18
{
19
int a;
20
u0;
21
struct
22
{
23
int b;
24
};
25
};
26
27
union u1
28
{
29
int b;
30
s0;
31
union
32
{
33
int c;
34
};
35
};
36
37
struct s2
38
{
39
struct
40
{
41
int a;
42
};
43
};
44
45
struct s3
46
{
47
u0;
48
};
49
50
struct s4
51
{
52
struct
53
{
54
int i;
55
};
56
int a[];
57
};
58
59
struct s1 x =
60
{
61
.b = 1,
62
.i = 2,
63
.a = 3
64
};
65
66
int o = offsetof (struct s1, i);
67
68
void
69
f (void)
70
{
71
x.i = 3;
72
(&x)->i = 4;
73
}