1 | // RUN: %clang_cc1 -fexceptions -fcxx-exceptions -verify %s |
2 | |
3 | struct S0; |
4 | struct S1; |
5 | struct S2; |
6 | struct S3; |
7 | struct S4; |
8 | struct S5; |
9 | struct S6; |
10 | |
11 | struct S0 { int x; }; |
12 | |
13 | void f0() { |
14 | typedef struct S1 { int x; } S1_typedef; |
15 | |
16 | (void)((struct S2 { int x; }*)0); // expected-error{{cannot be defined}} |
17 | |
18 | struct S3 { int x; } s3; |
19 | |
20 | (void)static_cast<struct S4 { int x; } *>(0); // expected-error{{cannot be defined}} |
21 | } |
22 | |
23 | struct S5 { int x; } f1() { return S5(); } // expected-error{{result type}} |
24 | |
25 | void f2(struct S6 { int x; } p); // expected-error{{parameter type}} |
26 | |
27 | struct pr19018 { |
28 | short foo6 (enum bar0 {qq} bar3); // expected-error{{cannot be defined in a parameter type}} |
29 | }; |
30 | |
31 | void pr19018_1 (enum e19018_1 {qq} x); // expected-error{{cannot be defined in a parameter type}} |
32 | void pr19018_1a (enum e19018_1 {qq} x); // expected-error{{cannot be defined in a parameter type}} |
33 | e19018_1 x2; |
34 | |
35 | void pr19018_2 (enum {qq} x); // expected-error{{cannot be defined in a parameter type}} |
36 | void pr19018_3 (struct s19018_2 {int qq;} x); // expected-error{{cannot be defined in a parameter type}} |
37 | void pr19018_4 (struct {int qq;} x); // expected-error{{cannot be defined in a parameter type}} |
38 | void pr19018_5 (struct { void qq(); } x); // expected-error{{cannot be defined in a parameter type}} |
39 | void pr19018_5 (struct s19018_2 { void qq(); } x); // expected-error{{cannot be defined in a parameter type}} |
40 | |
41 | struct pr19018a { |
42 | static int xx; |
43 | void func1(enum t19018 {qq} x); // expected-error{{cannot be defined in a parameter type}} |
44 | void func2(enum t19018 {qq} x); // expected-error{{cannot be defined in a parameter type}} |
45 | void func3(enum {qq} x); // expected-error{{cannot be defined in a parameter type}} |
46 | void func4(struct t19018 {int qq;} x); // expected-error{{cannot be defined in a parameter type}} |
47 | void func5(struct {int qq;} x); // expected-error{{cannot be defined in a parameter type}} |
48 | void func6(struct { void qq(); } x); // expected-error{{cannot be defined in a parameter type}} |
49 | void func7(struct t19018 { void qq(); } x); // expected-error{{cannot be defined in a parameter type}} |
50 | void func8(struct { int qq() { return xx; }; } x); // expected-error{{cannot be defined in a parameter type}} |
51 | void func9(struct t19018 { int qq() { return xx; }; } x); // expected-error{{cannot be defined in a parameter type}} |
52 | }; |
53 | |
54 | struct s19018b { |
55 | void func1 (enum en_2 {qq} x); // expected-error{{cannot be defined in a parameter type}} |
56 | en_2 x1; |
57 | void func2 (enum en_3 {qq} x); // expected-error{{cannot be defined in a parameter type}} |
58 | enum en_3 x2; |
59 | }; |
60 | |
61 | struct pr18963 { |
62 | short bar5 (struct foo4 {} bar2); // expected-error{{'foo4' cannot be defined in a parameter type}} |
63 | long foo5 (float foo6 = foo4); |
64 | }; |
65 | |
66 | // expected-error@+2 {{cannot be defined in a parameter type}} |
67 | // expected-note@+1 {{previous definition is here}} |
68 | void func_with_eh_and_type(struct type_in_eh {} o) throw(int) {} |
69 | struct type_in_eh {}; // expected-error {{redefinition of 'type_in_eh'}} |
70 | |