blob: 59bf54eb62fe56ad7c643df5626d4605c08f2416 [file] [log] [blame]
Francois Pichet8e161ed2010-11-23 06:07:27 +00001// RUN: %clang_cc1 %s -fsyntax-only -Wno-unused-value -Wmicrosoft -verify -fms-extensions
Chandler Carruthb6448942010-10-06 06:50:05 +00002
3
4struct A
5{
6 int a[]; /* expected-warning {{flexible array member 'a' in otherwise empty struct is a Microsoft extension}} */
7};
8
9struct C {
10 int l;
11 union {
12 int c1[]; /* expected-warning {{flexible array member 'c1' in a union is a Microsoft extension}} */
13 char c2[]; /* expected-warning {{flexible array member 'c2' in a union is a Microsoft extension}} */
14 };
15};
16
17
18struct D {
19 int l;
20 int D[];
21};
Francois Pichet842e7a22010-10-18 15:01:13 +000022
23
24enum ENUM1; // expected-warning {{forward references to 'enum' types are a Microsoft extension}}
25enum ENUM1 var1 = 3;
26enum ENUM1* var2 = 0;
27
28
29enum ENUM2 {
Francois Pichet8e161ed2010-11-23 06:07:27 +000030 ENUM2_a = (enum ENUM2) 4,
31 ENUM2_b = 0x9FFFFFFF, // expected-warning {{enumerator value is not representable in the underlying type 'int'}}
32 ENUM2_c = 0x100000000 // expected-warning {{enumerator value is not representable in the underlying type 'int'}}
Francois Pichet842e7a22010-10-18 15:01:13 +000033};
Francois Pichet8e161ed2010-11-23 06:07:27 +000034
35
36
37
38typedef struct notnested {
39 long bad1;
40 long bad2;
41} NOTNESTED;
42
43
44typedef struct nested1 {
45 long a;
46 struct notnested var1;
47 NOTNESTED var2;
48} NESTED1;
49
50struct nested2 {
51 long b;
52 NESTED1; // expected-warning {{anonymous structs are a Microsoft extension}}
53};
54
55struct test {
56 int c;
57 struct nested2; // expected-warning {{anonymous structs are a Microsoft extension}}
58};
59
60void foo()
61{
62 struct test var;
63 var.a;
64 var.b;
65 var.c;
66 var.bad1; // expected-error {{no member named 'bad1' in 'struct test'}}
67 var.bad2; // expected-error {{no member named 'bad2' in 'struct test'}}
68}
69
Douglas Gregor86f208c2011-02-22 20:32:04 +000070// Enumeration types with a fixed underlying type.
71const int seventeen = 17;
72typedef int Int;
73
74struct X0 {
75 enum E1 : Int { SomeOtherValue } field; // expected-warning{{enumeration types with a fixed underlying type are a Microsoft extension}}
76 enum E1 : seventeen;
77};
78
79enum : long { // expected-warning{{enumeration types with a fixed underlying type are a Microsoft extension}}
80 SomeValue = 0x100000000
81};