1 // RUN: %clang_cc1 %s -triple i686-pc-win32 -fsyntax-only -Wmicrosoft -verify -fms-extensions -fexceptions -fcxx-exceptions
4 // ::type_info is predeclared with forward class declartion
5 void f(const type_info &a);
8 // Microsoft doesn't validate exception specification.
9 namespace microsoft_exception_spec {
11 void foo(); // expected-note {{previous declaration}}
12 void foo() throw(); // expected-warning {{exception specification in declaration does not match previous declaration}}
14 void r6() throw(...); // expected-note {{previous declaration}}
15 void r6() throw(int); // expected-warning {{exception specification in declaration does not match previous declaration}}
19 virtual void f3() throw(...);
22 struct Derived : Base {
23 virtual void f2() throw(...);
28 virtual ~A() throw(); // expected-note {{overridden virtual function is here}}
32 virtual ~B(); // expected-warning {{exception specification of overriding function is more lax than base version}}
37 // MSVC allows type definition in anonymous union and struct
43 struct B // expected-warning {{types declared in an anonymous union are a Microsoft extension}}
48 union C // expected-warning {{types declared in an anonymous union are a Microsoft extension}}
54 typedef int D; // expected-warning {{types declared in an anonymous union are a Microsoft extension}}
55 struct F; // expected-warning {{types declared in an anonymous union are a Microsoft extension}}
62 struct B2 // expected-warning {{types declared in an anonymous struct are a Microsoft extension}}
67 union C2 // expected-warning {{types declared in an anonymous struct are a Microsoft extension}}
73 typedef int D2; // expected-warning {{types declared in an anonymous struct are a Microsoft extension}}
74 struct F2; // expected-warning {{types declared in an anonymous struct are a Microsoft extension}}
81 float __stdcall subtractP();
84 // __unaligned handling
85 typedef char __unaligned *aligned_type;
88 template<typename T> void h1(T (__stdcall M::* const )()) { }
104 // This is an ambiguous call in standard C++.
105 // This calls f(long long) in Microsoft mode because LL is always signed.
106 f(0xffffffffffffffffLL);
107 f(0xffffffffffffffffi64);
110 // Enumeration types with a fixed underlying type.
111 const int seventeen = 17;
115 enum E1 : Int { SomeOtherValue } field; // expected-warning{{enumeration types with a fixed underlying type are a Microsoft extension}}
119 enum : long long { // expected-warning{{enumeration types with a fixed underlying type are a Microsoft extension}}
120 SomeValue = 0x100000000
125 __declspec(dllimport) void f(void) { }
129 __declspec(dllimport) void AAA::f2(void) { // expected-error {{dllimport attribute can be applied only to symbol}}
138 void f(int g = 10 ); // expected-note {{previous definition is here}}
142 void BB<T>::f(int g = 0) { } // expected-warning {{redefinition of default argument}}
146 extern void static_func();
147 void static_func(); // expected-note {{previous declaration is here}}
150 static void static_func() // expected-warning {{static declaration of 'static_func' follows non-static declaration}}
155 long function_prototype(int a);
156 long (*function_ptr)(int a);
158 void function_to_voidptr_conv() {
159 void *a1 = function_prototype;
160 void *a2 = &function_prototype;
161 void *a3 = function_ptr;
165 void pointer_to_integral_type_conv(char* ptr) {
167 short sh = (short)ptr;
173 namespace friend_as_a_forward_decl {
198 virtual void f() = 0;
201 int array[__is_abstract(X)? 1 : -1];
204 void f() { int __except = 0; }