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 void foo(); // expected-note {{previous declaration}}
10 void foo() throw(); // expected-warning {{exception specification in declaration does not match previous declaration}}
12 void r6() throw(...); // expected-note {{previous declaration}}
13 void r6() throw(int); // expected-warning {{exception specification in declaration does not match previous declaration}}
17 virtual void f3() throw(...);
20 struct Derived
: Base
{
21 virtual void f2() throw(...);
26 // MSVC allows type definition in anonymous union and struct
32 struct B
// expected-warning {{types declared in an anonymous union are a Microsoft extension}}
37 union C
// expected-warning {{types declared in an anonymous union are a Microsoft extension}}
43 typedef int D
; // expected-warning {{types declared in an anonymous union are a Microsoft extension}}
44 struct F
; // expected-warning {{types declared in an anonymous union are a Microsoft extension}}
51 struct B2
// expected-warning {{types declared in an anonymous struct are a Microsoft extension}}
56 union C2
// expected-warning {{types declared in an anonymous struct are a Microsoft extension}}
62 typedef int D2
; // expected-warning {{types declared in an anonymous struct are a Microsoft extension}}
63 struct F2
; // expected-warning {{types declared in an anonymous struct are a Microsoft extension}}
70 float __stdcall
subtractP();
73 template<typename T
> void h1(T (__stdcall
M::* const )()) { }
80 //MSVC allows forward enum declaration
81 enum ENUM
; // expected-warning {{forward references to 'enum' types are a Microsoft extension}}
84 enum ENUM1
* var3
= 0;// expected-warning {{forward references to 'enum' types are a Microsoft extension}}
88 ENUM2_a
= (enum ENUM2
) 4,
89 ENUM2_b
= 0x9FFFFFFF, // expected-warning {{enumerator value is not representable in the underlying type 'int'}}
90 ENUM2_c
= 0x100000000 // expected-warning {{enumerator value is not representable in the underlying type 'int'}}
99 // This is an ambiguous call in standard C++.
100 // This calls f(long long) in Microsoft mode because LL is always signed.
101 f(0xffffffffffffffffLL
);
102 f(0xffffffffffffffffi
64);
105 // Enumeration types with a fixed underlying type.
106 const int seventeen
= 17;
110 enum E1
: Int
{ SomeOtherValue
} field
; // expected-warning{{enumeration types with a fixed underlying type are a Microsoft extension}}
114 enum : long long { // expected-warning{{enumeration types with a fixed underlying type are a Microsoft extension}}
115 SomeValue
= 0x100000000
120 __declspec(dllimport
) void f(void) { }
124 __declspec(dllimport
) void AAA::f2(void) { // expected-error {{dllimport attribute can be applied only to symbol}}
133 void f(int g
= 10 ); // expected-note {{previous definition is here}}
137 void BB
<T
>::f(int g
= 0) { } // expected-warning {{redefinition of default argument}}
140 namespace MissingTypename
{
142 template<class T
> class A
{
147 template<class T
> class B
{
153 template<class T
, class U
>
154 class C
: private A
<T
>, public B
<U
> {
160 A
<T
>::TYPE a1
; // expected-warning {{missing 'typename' prior to dependent type name}}
161 Base1::TYPE a2
; // expected-warning {{missing 'typename' prior to dependent type name}}
163 B
<U
>::TYPE a3
; // expected-warning {{missing 'typename' prior to dependent type name}}
164 Base2::TYPE a4
; // expected-warning {{missing 'typename' prior to dependent type name}}
166 A
<U
>::TYPE a5
; // expected-error {{missing 'typename' prior to dependent type name}}
167 Base3::TYPE a6
; // expected-error {{missing 'typename' prior to dependent type name}}
175 extern void static_func();
176 void static_func(); // expected-note {{previous declaration is here}}
179 static void static_func() // expected-warning {{static declaration of 'static_func' follows non-static declaration}}
184 long function_prototype(int a
);
185 long (*function_ptr
)(int a
);
187 void function_to_voidptr_conv() {
188 void *a1
= function_prototype
;
189 void *a2
= &function_prototype
;
190 void *a3
= function_ptr
;
194 void pointer_to_integral_type_conv(char* ptr
) {
196 short sh
= (short)ptr
;