1 // RUN: %clang_cc1 %s -fsyntax-only -Wno-unused-value -Wmicrosoft -verify -fms-extensions
6 int a[]; /* expected-warning {{flexible array member 'a' in otherwise empty struct is a Microsoft extension}} */
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}} */
28 typedef struct notnested {
34 typedef struct nested1 {
36 struct notnested var1;
42 NESTED1; // expected-warning {{anonymous structs are a Microsoft extension}}
47 struct nested2; // expected-warning {{anonymous structs are a Microsoft extension}}
56 var.bad1; // expected-error {{no member named 'bad1' in 'struct test'}}
57 var.bad2; // expected-error {{no member named 'bad2' in 'struct test'}}
60 // Enumeration types with a fixed underlying type.
61 const int seventeen = 17;
65 enum E1 : Int { SomeOtherValue } field; // expected-warning{{enumeration types with a fixed underlying type are a Microsoft extension}}
69 enum : long long { // expected-warning{{enumeration types with a fixed underlying type are a Microsoft extension}}
70 SomeValue = 0x100000000
74 void pointer_to_integral_type_conv(char* ptr) {
76 short sh = (short)ptr;
80 // This is valid ISO C.
86 UNKNOWN u; // expected-error {{unknown type name 'UNKNOWN'}}
90 AA; // expected-warning {{anonymous structs are a Microsoft extension}}
93 __declspec(deprecated("This is deprecated")) enum DE1 { one, two } e1; // expected-note {{'e1' declared here}}
94 struct __declspec(deprecated) DS1 { int i; float f; }; // expected-note {{declared here}}
96 #define MY_TEXT "This is also deprecated"
97 __declspec(deprecated(MY_TEXT)) void Dfunc1( void ) {} // expected-note {{'Dfunc1' declared here}}
99 struct __declspec(deprecated(123)) DS2 {}; // expected-error {{'deprecated' attribute requires a string}}
102 e1 = one; // expected-warning {{'e1' is deprecated: This is deprecated}}
103 struct DS1 s = { 0 }; // expected-warning {{'DS1' is deprecated}}
104 Dfunc1(); // expected-warning {{'Dfunc1' is deprecated: This is also deprecated}}
106 enum DE1 no; // no warning because E1 is not deprecated
109 int __sptr wrong1; // expected-error {{'__sptr' attribute only applies to pointer arguments}}
110 // The modifier must follow the asterisk
111 int __sptr *wrong_psp; // expected-error {{'__sptr' attribute only applies to pointer arguments}}
112 int * __sptr __uptr wrong2; // expected-error {{'__sptr' and '__uptr' attributes are not compatible}}
113 int * __sptr __sptr wrong3; // expected-warning {{attribute '__sptr' is already applied}}
115 // It is illegal to overload based on the type attribute.
116 void ptr_func(int * __ptr32 i) {} // expected-note {{previous definition is here}}
117 void ptr_func(int * __ptr64 i) {} // expected-error {{redefinition of 'ptr_func'}}
119 // It is also illegal to overload based on the pointer type attribute.
120 void ptr_func2(int * __sptr __ptr32 i) {} // expected-note {{previous definition is here}}
121 void ptr_func2(int * __uptr __ptr32 i) {} // expected-error {{redefinition of 'ptr_func2'}}
123 int * __sptr __ptr32 __sptr wrong4; // expected-warning {{attribute '__sptr' is already applied}}
125 __ptr32 int *wrong5; // expected-error {{'__ptr32' attribute only applies to pointer arguments}}
127 int *wrong6 __ptr32; // expected-error {{expected ';' after top level declarator}} expected-warning {{declaration does not declare anything}}
129 int * __ptr32 __ptr64 wrong7; // expected-error {{'__ptr32' and '__ptr64' attributes are not compatible}}
131 int * __ptr32 __ptr32 wrong8; // expected-warning {{attribute '__ptr32' is already applied}}
133 int *(__ptr32 __sptr wrong9); // expected-error {{'__sptr' attribute only applies to pointer arguments}} // expected-error {{'__ptr32' attribute only applies to pointer arguments}}
136 T __ptr32 wrong10; // expected-error {{'__ptr32' attribute only applies to pointer arguments}}