forked from ShivamSarodia/ShivyC
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patherror_struct.c
More file actions
108 lines (82 loc) · 1.78 KB
/
error_struct.c
File metadata and controls
108 lines (82 loc) · 1.78 KB
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
int main() {
struct R {
// error: cannot have storage specifier on struct member
extern int a;
// error: cannot have storage specifier on struct member
auto int a;
// error: cannot have incomplete type as struct member
struct R a;
// error: cannot have function type as struct member
int function(int);
// error: missing name of struct member
int*;
};
struct S {
int apple;
// error: duplicate member 'apple'
int apple;
// error: duplicate member 'apple'
int apple;
// error: duplicate member 'banana'
int banana, banana;
};
struct A {
int a;
} *a;
struct B {
int a;
} *b;
// error: conversion from incompatible pointer type
a = b;
struct C *p;
// error: invalid arithmetic on pointer to incomplete type
p + 1;
struct C {
int a;
};
p + 1;
{
struct C* q;
q + 1;
struct C;
struct C* r;
// error: invalid arithmetic on pointer to incomplete type
r + 1;
struct C {
int a;
};
r + 1;
}
struct D {
int a;
};
// error: redefinition of 'struct D'
struct D {
int a;
};
// error: defined as wrong kind of tag 'union D'
union D {
int a;
};
struct E;
// error: defined as wrong kind of tag 'union E'
union E;
struct Struct {
int a;
long b;
int* c;
} s, *s_p;
// error: variable of incomplete type declared
struct E e;
// error: request for member in something not a structure or union
10.a;
// error: request for member in something not a structure or union
s_p.a;
int *int_ptr;
// error: request for member in something not a structure or union
int_ptr->a;
// error: first argument of '->' must have pointer type
s->a;
// error: structure or union has no member 'd'
s.d;
}