Require target lra in gcc.dg/pr108095.c
[official-gcc.git] / gcc / testsuite / gcc.dg / declspec-18.c
blob2885692e1f38fbb699828330784f30d02bd19284
1 /* { dg-do compile } */
2 /* { dg-options "-std=gnu89" } */
4 static t1 *a; /* { dg-error "unknown type name 't1'" } */
6 int z; /* { dg-message "previous declaration of 'z'" } */
7 typedef t2 *z; /* { dg-error "unknown type name 't2'" } */
8 /* { dg-error "'z' redeclared " "redeclared" { target *-*-* } .-1 } */
10 extern t3 p1(void); /* { dg-error "unknown type name 't3'" } */
11 int p2(const t4 x); /* { dg-error "unknown type name 't4'" } */
12 int p3(const t1 x); /* { dg-error "unknown type name 't1'" } */ /* dup??? */
13 int p4(t5 (*x)(void)); /* { dg-error "unknown type name 't5'" } */
14 int p5(t6 *); /* { dg-error "unknown type name 't6'" } */
15 int p6(t7 x); /* { dg-error "unknown type name 't7'" } */
16 int p7(t8[]); /* { dg-error "unknown type name 't8'" } */
17 int p8(int, t9); /* { dg-error "unknown type name 't9'" } */
19 struct s {
20 const t1 a; /* { dg-error "unknown type name 't1'" } */ /* dup??? */
21 const t10 b; /* { dg-error "unknown type name 't10'" } */
22 int b; /* { dg-error "duplicate member" } */
25 typeof (z) c1;
27 typeof (x1) c2;
28 /* { dg-error "undeclared" "undeclared" { target *-*-* } .-1 } */
29 /* { dg-bogus "unknown type name 'x1'" "unknown" { target *-*-* } .-2 } */
31 typeof (const t11) c3; /* { dg-error "unknown type name 't11'" } */
33 typeof (t12 *) c3;
34 /* { dg-error "unknown type name 't12'" "t12" { xfail *-*-* } .-1 } */
35 /* { dg-bogus "undeclared" "undeclared" { xfail *-*-* } .-2 } */
36 /* { dg-bogus "expected expression before" "expected" { xfail *-*-* } .-3 } */
38 int recover1;
40 int s0 = sizeof (z);
42 int s1 = sizeof (x2);
43 /* { dg-error "undeclared" "undeclared" { target *-*-* } .-1 } */
44 /* { dg-bogus "unknown type name 'x2'" "unknown" { target *-*-* } .-2 } */
46 int s2 = sizeof (const t13); /* { dg-error "unknown type name 't13'" } */
48 int s3 = sizeof (t14 *);
49 /* { dg-error "unknown type name 't14'" "t14" { xfail *-*-* } .-1 } */
50 /* { dg-bogus "undeclared" "undeclared" { xfail *-*-* } .-2 } */
51 /* { dg-bogus "expected expression before" "expected" { xfail *-*-* } .-3 } */
53 int recover2;
55 int a0 = __alignof__ (z);
57 int a1 = __alignof__ (x3); /* { dg-error "undeclared" } */
58 /* { dg-bogus "unknown type name 'x3'" "" { target *-*-* } .-1 } */
60 int a2 = __alignof__ (const t15); /* { dg-error "unknown type name 't15'" } */
62 int a3 = __alignof__ (t16 *);
63 /* { dg-error "unknown type name 't16'" "t16" { xfail *-*-* } .-1 } */
64 /* { dg-bogus "undeclared" "undeclared" { xfail *-*-* } .-2 } */
65 /* { dg-bogus "expected expression before" "expected" { xfail *-*-* } .-3 } */
67 int recover3;
70 /* Cannot detect (undefd_type *) or (undefd_type (*) because it would
71 require 3 tokens of lookahead (same as above). */
73 const char *f1()
75 return (const t17) "abc"; /* { dg-error "unknown type name 't17'" "t17" } */
76 /* { dg-bogus "expected" "expected" { target *-*-* } .-1 } */
79 const char *f2()
81 return (const t18 *) "abc"; /* { dg-error "unknown type name 't18'" "t18" } */
82 /* { dg-bogus "expected" "expected" { target *-*-* } .-1 } */
86 /* The parser has problems distinguishing semantic and syntactic errors,
87 so it emits a wrong "expected ')'" error here. */
89 void *f3(int x)
91 return (void *) ((void *(*)(t19)) f3); /* { dg-error "unknown type name 't19'" "t19" } */
92 /* { dg-bogus "expected" "expected" { xfail *-*-* } .-1 } */
95 const void *f4()
97 return &((const t20){1}); /* { dg-error "unknown type name 't20'" } */
98 /* { dg-bogus "return discards 'const'" "discards" { target *-*-* } .-1 } */
99 /* { dg-bogus "expected" "expected" { target *-*-* } .-2 } */
102 int f5(__builtin_va_list ap)
104 int x = __builtin_va_arg (ap, t21); /* { dg-error "unknown type name 't21'" } */
105 int y = __builtin_va_arg (ap, const t22); /* { dg-error "unknown type name 't22'" } */
108 int f6(void)
110 return __builtin_offsetof (t23, field); /* { dg-error "unknown type name 't23'" "t23" } */
111 /* { dg-bogus "request for member" "request" { target *-*-* } .-1 } */