Update concepts branch to revision 131834
[official-gcc.git] / gcc / testsuite / gcc.dg / declspec-13.c
bloba325c0d883196b7c49cfc80972b879e7ffef9877
1 /* Test declaration specifiers. Test messages for bad type
2 specifiers. */
3 /* Origin: Joseph Myers <jsm@polyomino.org.uk> */
4 /* { dg-do compile } */
5 /* { dg-options "-std=gnu89 -pedantic" } */
7 /* typeof should act much like typedef, so the following are
8 invalid. */
9 typeof(double) long x0; /* { dg-error "two or more data types in declaration specifiers" } */
10 typeof(double) _Complex x1; /* { dg-error "two or more data types in declaration specifiers" } */
12 /* The following is erroneous, and used to get a bogus message about
13 complex integer types. */
14 typedef double D;
15 D _Complex x2; /* { dg-error "two or more data types in declaration specifiers" } */
17 /* The following empty declarations should have problems in their type
18 specifiers diagnosed, not just the general problem that they are
19 empty declarations. */
20 long short; /* { dg-error "both 'long' and 'short' in declaration specifiers" } */
21 /* { dg-warning "useless type name in empty declaration" "empty" { target *-*-* } 20 } */
22 _Complex double; /* { dg-warning "ISO C90 does not support complex types" } */
23 /* { dg-warning "useless type name in empty declaration" "empty" { target *-*-* } 22 } */
24 _Complex; /* { dg-warning "ISO C90 does not support complex types" } */
25 /* { dg-warning "ISO C does not support plain 'complex' meaning 'double complex'" "ISO C" { target *-*-* } 24 } */
26 /* { dg-warning "useless type name in empty declaration" "empty" { target *-*-* } 24 } */
27 _Complex int; /* { dg-warning "ISO C90 does not support complex types" } */
28 /* { dg-warning "ISO C does not support complex integer types" "ISO C" { target *-*-* } 27 } */
29 /* { dg-warning "useless type name in empty declaration" "empty" { target *-*-* } 27 } */
31 /* Specific messages for each invalid combination. (That some message
32 is given when appropriate for a larger collection of combinations
33 of type specifiers is tested in *typespec*.c.) */
35 long double long x3; /* { dg-error "both 'long long' and 'double' in declaration specifiers" } */
36 short long x4; /* { dg-error "both 'long' and 'short' in declaration specifiers" } */
37 void long x5; /* { dg-error "both 'long' and 'void' in declaration specifiers" } */
38 _Bool long x6; /* { dg-error "both 'long' and '_Bool' in declaration specifiers" } */
39 char long x7; /* { dg-error "both 'long' and 'char' in declaration specifiers" } */
40 float long x8; /* { dg-error "both 'long' and 'float' in declaration specifiers" } */
41 long short x9; /* { dg-error "both 'long' and 'short' in declaration specifiers" } */
42 void short x10; /* { dg-error "both 'short' and 'void' in declaration specifiers" } */
43 _Bool short x11; /* { dg-error "both 'short' and '_Bool' in declaration specifiers" } */
44 char short x12; /* { dg-error "both 'short' and 'char' in declaration specifiers" } */
45 float short x13; /* { dg-error "both 'short' and 'float' in declaration specifiers" } */
46 double short x14; /* { dg-error "both 'short' and 'double' in declaration specifiers" } */
47 unsigned signed x15; /* { dg-error "both 'signed' and 'unsigned' in declaration specifiers" } */
48 void signed x16; /* { dg-error "both 'signed' and 'void' in declaration specifiers" } */
49 _Bool signed x17; /* { dg-error "both 'signed' and '_Bool' in declaration specifiers" } */
50 float signed x18; /* { dg-error "both 'signed' and 'float' in declaration specifiers" } */
51 double signed x19; /* { dg-error "both 'signed' and 'double' in declaration specifiers" } */
52 signed unsigned x20; /* { dg-error "both 'signed' and 'unsigned' in declaration specifiers" } */
53 void unsigned x21; /* { dg-error "both 'unsigned' and 'void' in declaration specifiers" } */
54 _Bool unsigned x22; /* { dg-error "both 'unsigned' and '_Bool' in declaration specifiers" } */
55 float unsigned x23; /* { dg-error "both 'unsigned' and 'float' in declaration specifiers" } */
56 double unsigned x24; /* { dg-error "both 'unsigned' and 'double' in declaration specifiers" } */
57 void _Complex x25; /* { dg-error "both 'complex' and 'void' in declaration specifiers" } */
58 /* { dg-warning "ISO C90 does not support complex types" "C90" { target *-*-* } 57 } */
59 _Bool _Complex x26; /* { dg-error "both 'complex' and '_Bool' in declaration specifiers" } */
60 /* { dg-warning "ISO C90 does not support complex types" "C90" { target *-*-* } 59 } */
62 long void x27; /* { dg-error "both 'long' and 'void' in declaration specifiers" } */
63 short void x28; /* { dg-error "both 'short' and 'void' in declaration specifiers" } */
64 signed void x29; /* { dg-error "both 'signed' and 'void' in declaration specifiers" } */
65 unsigned void x30; /* { dg-error "both 'unsigned' and 'void' in declaration specifiers" } */
66 _Complex void x31; /* { dg-error "both 'complex' and 'void' in declaration specifiers" } */
67 /* { dg-warning "ISO C90 does not support complex types" "C90" { target *-*-* } 66 } */
68 /* { dg-warning "ISO C does not support plain 'complex' meaning 'double complex'" "complex" { target *-*-* } 66 } */
69 long _Bool x32; /* { dg-error "both 'long' and '_Bool' in declaration specifiers" } */
70 short _Bool x33; /* { dg-error "both 'short' and '_Bool' in declaration specifiers" } */
71 signed _Bool x34; /* { dg-error "both 'signed' and '_Bool' in declaration specifiers" } */
72 unsigned _Bool x35; /* { dg-error "both 'unsigned' and '_Bool' in declaration specifiers" } */
73 _Complex _Bool x36; /* { dg-error "both 'complex' and '_Bool' in declaration specifiers" } */
74 /* { dg-warning "ISO C90 does not support complex types" "C90" { target *-*-* } 73 } */
75 /* { dg-warning "ISO C does not support plain 'complex' meaning 'double complex'" "complex" { target *-*-* } 73 } */
76 long char x37; /* { dg-error "both 'long' and 'char' in declaration specifiers" } */
77 short char x38; /* { dg-error "both 'short' and 'char' in declaration specifiers" } */
78 long float x39; /* { dg-error "both 'long' and 'float' in declaration specifiers" } */
79 short float x40; /* { dg-error "both 'short' and 'float' in declaration specifiers" } */
80 signed float x41; /* { dg-error "both 'signed' and 'float' in declaration specifiers" } */
81 unsigned float x42; /* { dg-error "both 'unsigned' and 'float' in declaration specifiers" } */
82 long long double x43; /* { dg-error "both 'long long' and 'double' in declaration specifiers" } */
83 /* { dg-warning "ISO C90 does not support 'long long'" "C90" { target *-*-* } 82 } */
84 short double x44; /* { dg-error "both 'short' and 'double' in declaration specifiers" } */
85 signed double x45; /* { dg-error "both 'signed' and 'double' in declaration specifiers" } */
86 unsigned double x46; /* { dg-error "both 'unsigned' and 'double' in declaration specifiers" } */