1*67e74705SXin Li // RUN: %clang_cc1 %s -triple i386-pc-win32 -std=c++14 -fsyntax-only -Wno-unused-getter-return-value -Wno-unused-value -Wmicrosoft -verify -fms-extensions -fms-compatibility -fdelayed-template-parsing
2*67e74705SXin Li
3*67e74705SXin Li /* Microsoft attribute tests */
4*67e74705SXin Li [repeatable][source_annotation_attribute( Parameter|ReturnValue )]
5*67e74705SXin Li struct SA_Post{ SA_Post(); int attr; };
6*67e74705SXin Li
7*67e74705SXin Li [returnvalue:SA_Post( attr=1)]
8*67e74705SXin Li int foo1([SA_Post(attr=1)] void *param);
9*67e74705SXin Li
10*67e74705SXin Li namespace {
11*67e74705SXin Li [returnvalue:SA_Post(attr=1)]
12*67e74705SXin Li int foo2([SA_Post(attr=1)] void *param);
13*67e74705SXin Li }
14*67e74705SXin Li
15*67e74705SXin Li class T {
16*67e74705SXin Li [returnvalue:SA_Post(attr=1)]
17*67e74705SXin Li int foo3([SA_Post(attr=1)] void *param);
18*67e74705SXin Li };
19*67e74705SXin Li
20*67e74705SXin Li extern "C" {
21*67e74705SXin Li [returnvalue:SA_Post(attr=1)]
22*67e74705SXin Li int foo5([SA_Post(attr=1)] void *param);
23*67e74705SXin Li }
24*67e74705SXin Li
25*67e74705SXin Li class class_attr {
26*67e74705SXin Li public:
27*67e74705SXin Li class_attr([SA_Pre(Null=SA_No,NullTerminated=SA_Yes)] int a)
28*67e74705SXin Li {
29*67e74705SXin Li }
30*67e74705SXin Li };
31*67e74705SXin Li
32*67e74705SXin Li
33*67e74705SXin Li
uuidof_test1()34*67e74705SXin Li void uuidof_test1()
35*67e74705SXin Li {
36*67e74705SXin Li __uuidof(0); // expected-error {{you need to include <guiddef.h> before using the '__uuidof' operator}}
37*67e74705SXin Li }
38*67e74705SXin Li
39*67e74705SXin Li typedef struct _GUID
40*67e74705SXin Li {
41*67e74705SXin Li unsigned long Data1;
42*67e74705SXin Li unsigned short Data2;
43*67e74705SXin Li unsigned short Data3;
44*67e74705SXin Li unsigned char Data4[8];
45*67e74705SXin Li } GUID;
46*67e74705SXin Li
47*67e74705SXin Li struct __declspec(uuid(L"00000000-0000-0000-1234-000000000047")) uuid_attr_bad1 { };// expected-error {{'uuid' attribute requires a string}}
48*67e74705SXin Li struct __declspec(uuid(3)) uuid_attr_bad2 { };// expected-error {{'uuid' attribute requires a string}}
49*67e74705SXin Li struct __declspec(uuid("0000000-0000-0000-1234-0000500000047")) uuid_attr_bad3 { };// expected-error {{uuid attribute contains a malformed GUID}}
50*67e74705SXin Li struct __declspec(uuid("0000000-0000-0000-Z234-000000000047")) uuid_attr_bad4 { };// expected-error {{uuid attribute contains a malformed GUID}}
51*67e74705SXin Li struct __declspec(uuid("000000000000-0000-1234-000000000047")) uuid_attr_bad5 { };// expected-error {{uuid attribute contains a malformed GUID}}
52*67e74705SXin Li
53*67e74705SXin Li __declspec(uuid("000000A0-0000-0000-C000-000000000046")) int i; // expected-warning {{'uuid' attribute only applies to classes}}
54*67e74705SXin Li
55*67e74705SXin Li struct __declspec(uuid("000000A0-0000-0000-C000-000000000046"))
56*67e74705SXin Li struct_with_uuid { };
57*67e74705SXin Li struct struct_without_uuid { };
58*67e74705SXin Li
59*67e74705SXin Li struct __declspec(uuid("000000A0-0000-0000-C000-000000000049"))
60*67e74705SXin Li struct_with_uuid2;
61*67e74705SXin Li
62*67e74705SXin Li struct
63*67e74705SXin Li struct_with_uuid2 {} ;
64*67e74705SXin Li
uuid_sema_test()65*67e74705SXin Li int uuid_sema_test()
66*67e74705SXin Li {
67*67e74705SXin Li struct_with_uuid var_with_uuid[1];
68*67e74705SXin Li struct_without_uuid var_without_uuid[1];
69*67e74705SXin Li
70*67e74705SXin Li __uuidof(struct_with_uuid);
71*67e74705SXin Li __uuidof(struct_with_uuid2);
72*67e74705SXin Li __uuidof(struct_without_uuid); // expected-error {{cannot call operator __uuidof on a type with no GUID}}
73*67e74705SXin Li __uuidof(struct_with_uuid*);
74*67e74705SXin Li __uuidof(struct_without_uuid*); // expected-error {{cannot call operator __uuidof on a type with no GUID}}
75*67e74705SXin Li __uuidof(struct_with_uuid[1]);
76*67e74705SXin Li __uuidof(struct_with_uuid*[1]); // expected-error {{cannot call operator __uuidof on a type with no GUID}}
77*67e74705SXin Li __uuidof(const struct_with_uuid[1][1]);
78*67e74705SXin Li __uuidof(const struct_with_uuid*[1][1]); // expected-error {{cannot call operator __uuidof on a type with no GUID}}
79*67e74705SXin Li
80*67e74705SXin Li __uuidof(var_with_uuid);
81*67e74705SXin Li __uuidof(var_without_uuid);// expected-error {{cannot call operator __uuidof on a type with no GUID}}
82*67e74705SXin Li __uuidof(var_with_uuid[1]);
83*67e74705SXin Li __uuidof(var_without_uuid[1]);// expected-error {{cannot call operator __uuidof on a type with no GUID}}
84*67e74705SXin Li __uuidof(&var_with_uuid[1]);
85*67e74705SXin Li __uuidof(&var_without_uuid[1]);// expected-error {{cannot call operator __uuidof on a type with no GUID}}
86*67e74705SXin Li
87*67e74705SXin Li __uuidof(0);
88*67e74705SXin Li __uuidof(1);// expected-error {{cannot call operator __uuidof on a type with no GUID}}
89*67e74705SXin Li }
90*67e74705SXin Li
91*67e74705SXin Li
92*67e74705SXin Li template <class T>
template_uuid()93*67e74705SXin Li void template_uuid()
94*67e74705SXin Li {
95*67e74705SXin Li T expr;
96*67e74705SXin Li
97*67e74705SXin Li __uuidof(T);
98*67e74705SXin Li __uuidof(expr);
99*67e74705SXin Li }
100*67e74705SXin Li
101*67e74705SXin Li
102*67e74705SXin Li template <class T, const GUID* g = &__uuidof(T)> // expected-note {{template parameter is declared here}}
103*67e74705SXin Li class COM_CLASS_TEMPLATE { };
104*67e74705SXin Li
105*67e74705SXin Li typedef COM_CLASS_TEMPLATE<struct_with_uuid, &*&__uuidof(struct_with_uuid)> COM_TYPE_1; // expected-warning {{non-type template argument containing a dereference operation is a Microsoft extension}}
106*67e74705SXin Li typedef COM_CLASS_TEMPLATE<struct_with_uuid> COM_TYPE_2;
107*67e74705SXin Li
108*67e74705SXin Li template <class T, const GUID& g>
109*67e74705SXin Li class COM_CLASS_TEMPLATE_REF { };
110*67e74705SXin Li typedef COM_CLASS_TEMPLATE_REF<struct_with_uuid, __uuidof(struct_with_uuid)> COM_TYPE_REF;
111*67e74705SXin Li
112*67e74705SXin Li struct late_defined_uuid;
113*67e74705SXin Li template<typename T>
test_late_defined_uuid()114*67e74705SXin Li void test_late_defined_uuid() {
115*67e74705SXin Li __uuidof(late_defined_uuid);
116*67e74705SXin Li }
117*67e74705SXin Li struct __declspec(uuid("000000A0-0000-0000-C000-000000000049")) late_defined_uuid;
118*67e74705SXin Li
119*67e74705SXin Li COM_CLASS_TEMPLATE_REF<int, __uuidof(struct_with_uuid)> good_template_arg;
120*67e74705SXin Li
121*67e74705SXin Li COM_CLASS_TEMPLATE<int, __uuidof(struct_with_uuid)> bad_template_arg; // expected-error {{non-type template argument of type 'const _GUID' is not a constant expression}}
122*67e74705SXin Li
123*67e74705SXin Li namespace PR16911 {
124*67e74705SXin Li struct __declspec(uuid("{12345678-1234-1234-1234-1234567890aB}")) uuid;
125*67e74705SXin Li struct __declspec(uuid("{12345678-1234-1234-1234-1234567890aB}")) uuid2;
126*67e74705SXin Li
127*67e74705SXin Li template <typename T, typename T2>
128*67e74705SXin Li struct thing {
129*67e74705SXin Li };
130*67e74705SXin Li
131*67e74705SXin Li struct empty {};
132*67e74705SXin Li struct inher : public thing<empty, uuid2> {};
133*67e74705SXin Li
134*67e74705SXin Li struct __declspec(uuid("{12345678-1234-1234-1234-1234567890aB}")) uuid;
135*67e74705SXin Li const struct _GUID *w = &__uuidof(inher); // expected-error{{cannot call operator __uuidof on a type with no GUID}}
136*67e74705SXin Li const struct _GUID *x = &__uuidof(thing<uuid, inher>);
137*67e74705SXin Li const struct _GUID *y = &__uuidof(thing<uuid2, uuid>); // expected-error{{cannot call operator __uuidof on a type with multiple GUIDs}}
138*67e74705SXin Li thing<uuid2, uuid> thing_obj = thing<uuid2, uuid>();
139*67e74705SXin Li const struct _GUID *z = &__uuidof(thing_obj); // expected-error{{cannot call operator __uuidof on a type with multiple GUIDs}}
140*67e74705SXin Li }
141*67e74705SXin Li
142*67e74705SXin Li class CtorCall {
143*67e74705SXin Li public:
144*67e74705SXin Li CtorCall& operator=(const CtorCall& that);
145*67e74705SXin Li
146*67e74705SXin Li int a;
147*67e74705SXin Li };
148*67e74705SXin Li
operator =(const CtorCall & that)149*67e74705SXin Li CtorCall& CtorCall::operator=(const CtorCall& that)
150*67e74705SXin Li {
151*67e74705SXin Li if (this != &that) {
152*67e74705SXin Li this->CtorCall::~CtorCall();
153*67e74705SXin Li this->CtorCall::CtorCall(that); // expected-warning {{explicit constructor calls are a Microsoft extension}}
154*67e74705SXin Li }
155*67e74705SXin Li return *this;
156*67e74705SXin Li }
157*67e74705SXin Li
158*67e74705SXin Li template <class A>
159*67e74705SXin Li class C1 {
160*67e74705SXin Li public:
161*67e74705SXin Li template <int B>
162*67e74705SXin Li class Iterator {
163*67e74705SXin Li };
164*67e74705SXin Li };
165*67e74705SXin Li
166*67e74705SXin Li template<class T>
167*67e74705SXin Li class C2 {
168*67e74705SXin Li typename C1<T>:: /*template*/ Iterator<0> Mypos; // expected-warning {{use 'template' keyword to treat 'Iterator' as a dependent template name}}
169*67e74705SXin Li };
170*67e74705SXin Li
171*67e74705SXin Li template <class T>
missing_template_keyword()172*67e74705SXin Li void missing_template_keyword(){
173*67e74705SXin Li typename C1<T>:: /*template*/ Iterator<0> Mypos; // expected-warning {{use 'template' keyword to treat 'Iterator' as a dependent template name}}
174*67e74705SXin Li }
175*67e74705SXin Li
176*67e74705SXin Li
177*67e74705SXin Li
178*67e74705SXin Li class AAAA {
179*67e74705SXin Li typedef int D;
180*67e74705SXin Li };
181*67e74705SXin Li
182*67e74705SXin Li template <typename T>
183*67e74705SXin Li class SimpleTemplate {};
184*67e74705SXin Li
185*67e74705SXin Li template <class T>
redundant_typename()186*67e74705SXin Li void redundant_typename() {
187*67e74705SXin Li typename T t;// expected-warning {{expected a qualified name after 'typename'}}
188*67e74705SXin Li typename AAAA a;// expected-warning {{expected a qualified name after 'typename'}}
189*67e74705SXin Li
190*67e74705SXin Li t = 3;
191*67e74705SXin Li
192*67e74705SXin Li typedef typename T* pointerT;// expected-warning {{expected a qualified name after 'typename'}}
193*67e74705SXin Li typedef typename SimpleTemplate<int> templateT;// expected-warning {{expected a qualified name after 'typename'}}
194*67e74705SXin Li
195*67e74705SXin Li pointerT pT = &t;
196*67e74705SXin Li *pT = 4;
197*67e74705SXin Li
198*67e74705SXin Li int var;
199*67e74705SXin Li int k = typename var;// expected-error {{expected a qualified name after 'typename'}}
200*67e74705SXin Li }
201*67e74705SXin Li
202*67e74705SXin Li template <typename T>
203*67e74705SXin Li struct TypenameWrongPlace {
204*67e74705SXin Li typename typedef T::D D;// expected-warning {{expected a qualified name after 'typename'}}
205*67e74705SXin Li };
206*67e74705SXin Li
207*67e74705SXin Li extern TypenameWrongPlace<AAAA> PR16925;
208*67e74705SXin Li
209*67e74705SXin Li __interface MicrosoftInterface;
210*67e74705SXin Li __interface MicrosoftInterface {
211*67e74705SXin Li void foo1() = 0; // expected-note {{overridden virtual function is here}}
212*67e74705SXin Li virtual void foo2() = 0;
213*67e74705SXin Li };
214*67e74705SXin Li
215*67e74705SXin Li __interface MicrosoftDerivedInterface : public MicrosoftInterface {
216*67e74705SXin Li void foo1(); // expected-warning {{'foo1' overrides a member function but is not marked 'override'}}
217*67e74705SXin Li void foo2() override;
218*67e74705SXin Li void foo3();
219*67e74705SXin Li };
220*67e74705SXin Li
221*67e74705SXin Li void interface_test() {
222*67e74705SXin Li MicrosoftInterface* a;
223*67e74705SXin Li a->foo1();
224*67e74705SXin Li MicrosoftDerivedInterface* b;
225*67e74705SXin Li b->foo2();
226*67e74705SXin Li }
227*67e74705SXin Li
228*67e74705SXin Li __int64 x7 = __int64(0);
229*67e74705SXin Li _int64 x8 = _int64(0);
230*67e74705SXin Li static_assert(sizeof(_int64) == 8, "");
231*67e74705SXin Li static_assert(sizeof(_int32) == 4, "");
232*67e74705SXin Li static_assert(sizeof(_int16) == 2, "");
233*67e74705SXin Li static_assert(sizeof(_int8) == 1, "");
234*67e74705SXin Li
235*67e74705SXin Li int __identifier(generic) = 3;
236*67e74705SXin Li int __identifier(int) = 4;
237*67e74705SXin Li struct __identifier(class) { __identifier(class) *__identifier(for); };
238*67e74705SXin Li __identifier(class) __identifier(struct) = { &__identifier(struct) };
239*67e74705SXin Li
240*67e74705SXin Li int __identifier for; // expected-error {{missing '(' after '__identifier'}}
241*67e74705SXin Li int __identifier(else} = __identifier(for); // expected-error {{missing ')' after identifier}} expected-note {{to match this '('}}
242*67e74705SXin Li #define identifier_weird(x) __identifier(x
243*67e74705SXin Li int k = identifier_weird(if)); // expected-error {{use of undeclared identifier 'if'}}
244*67e74705SXin Li
245*67e74705SXin Li // This is a bit weird, but the alternative tokens aren't keywords, and this
246*67e74705SXin Li // behavior matches MSVC. FIXME: Consider supporting this anyway.
247*67e74705SXin Li extern int __identifier(and) r; // expected-error {{cannot convert '&&' token to an identifier}}
248*67e74705SXin Li
249*67e74705SXin Li void f() {
250*67e74705SXin Li __identifier(() // expected-error {{cannot convert '(' token to an identifier}}
251*67e74705SXin Li __identifier(void) // expected-error {{use of undeclared identifier 'void'}}
252*67e74705SXin Li __identifier()) // expected-error {{cannot convert ')' token to an identifier}}
253*67e74705SXin Li // FIXME: We should pick a friendlier display name for this token kind.
254*67e74705SXin Li __identifier(1) // expected-error {{cannot convert <numeric_constant> token to an identifier}}
255*67e74705SXin Li __identifier(+) // expected-error {{cannot convert '+' token to an identifier}}
256*67e74705SXin Li __identifier("foo") // expected-error {{cannot convert <string_literal> token to an identifier}}
257*67e74705SXin Li __identifier(;) // expected-error {{cannot convert ';' token to an identifier}}
258*67e74705SXin Li }
259*67e74705SXin Li
260*67e74705SXin Li class inline_definition_pure_spec {
261*67e74705SXin Li virtual int f() = 0 { return 0; }// expected-warning {{function definition with pure-specifier is a Microsoft extension}}
262*67e74705SXin Li virtual int f2() = 0;
263*67e74705SXin Li };
264*67e74705SXin Li
265*67e74705SXin Li struct pure_virtual_dtor {
266*67e74705SXin Li virtual ~pure_virtual_dtor() = 0;
267*67e74705SXin Li };
268*67e74705SXin Li pure_virtual_dtor::~pure_virtual_dtor() { }
269*67e74705SXin Li
270*67e74705SXin Li struct pure_virtual_dtor_inline {
271*67e74705SXin Li virtual ~pure_virtual_dtor_inline() = 0 { }// expected-warning {{function definition with pure-specifier is a Microsoft extension}}
272*67e74705SXin Li };
273*67e74705SXin Li
274*67e74705SXin Li
275*67e74705SXin Li int main () {
276*67e74705SXin Li // Necessary to force instantiation in -fdelayed-template-parsing mode.
277*67e74705SXin Li test_late_defined_uuid<int>();
278*67e74705SXin Li redundant_typename<int>();
279*67e74705SXin Li missing_template_keyword<int>();
280*67e74705SXin Li }
281*67e74705SXin Li
282*67e74705SXin Li namespace access_protected_PTM {
283*67e74705SXin Li class A {
284*67e74705SXin Li protected:
285*67e74705SXin Li void f(); // expected-note {{must name member using the type of the current context 'access_protected_PTM::B'}}
286*67e74705SXin Li };
287*67e74705SXin Li
288*67e74705SXin Li class B : public A{
289*67e74705SXin Li public:
290*67e74705SXin Li void test_access();
291*67e74705SXin Li static void test_access_static();
292*67e74705SXin Li };
293*67e74705SXin Li
294*67e74705SXin Li void B::test_access() {
295*67e74705SXin Li &A::f; // expected-error {{'f' is a protected member of 'access_protected_PTM::A'}}
296*67e74705SXin Li }
297*67e74705SXin Li
298*67e74705SXin Li void B::test_access_static() {
299*67e74705SXin Li &A::f;
300*67e74705SXin Li }
301*67e74705SXin Li }
302*67e74705SXin Li
303*67e74705SXin Li namespace Inheritance {
304*67e74705SXin Li class __single_inheritance A;
305*67e74705SXin Li class __multiple_inheritance B;
306*67e74705SXin Li class __virtual_inheritance C;
307*67e74705SXin Li }
308*67e74705SXin Li
309*67e74705SXin Li struct StructWithProperty {
310*67e74705SXin Li __declspec(property) int V0; // expected-error {{expected '(' after 'property'}}
311*67e74705SXin Li __declspec(property()) int V1; // expected-error {{property does not specify a getter or a putter}}
312*67e74705SXin Li __declspec(property(set)) int V2; // expected-error {{putter for property must be specified as 'put', not 'set'}} expected-error {{expected '=' after 'set'}}
313*67e74705SXin Li __declspec(property(ptu)) int V3; // expected-error {{missing 'get=' or 'put='}}
314*67e74705SXin Li __declspec(property(ptu=PutV)) int V4; // expected-error {{expected 'get' or 'put' in property declaration}}
315*67e74705SXin Li __declspec(property(get)) int V5; // expected-error {{expected '=' after 'get'}}
316*67e74705SXin Li __declspec(property(get&)) int V6; // expected-error {{expected '=' after 'get'}}
317*67e74705SXin Li __declspec(property(get=)) int V7; // expected-error {{expected name of accessor method}}
318*67e74705SXin Li __declspec(property(get=GetV)) int V8; // no-warning
319*67e74705SXin Li __declspec(property(get=GetV=)) int V9; // expected-error {{expected ',' or ')' at end of property accessor list}}
320*67e74705SXin Li __declspec(property(get=GetV,)) int V10; // expected-error {{expected 'get' or 'put' in property declaration}}
321*67e74705SXin Li __declspec(property(get=GetV,put=SetV)) int V11; // no-warning
322*67e74705SXin Li __declspec(property(get=GetV,put=SetV,get=GetV)) int V12; // expected-error {{property declaration specifies 'get' accessor twice}}
323*67e74705SXin Li __declspec(property(get=GetV)) int V13 = 3; // expected-error {{property declaration cannot have an in-class initializer}}
324*67e74705SXin Li
325*67e74705SXin Li int GetV() { return 123; }
326*67e74705SXin Li void SetV(int v) {}
327*67e74705SXin Li };
328*67e74705SXin Li void TestProperty() {
329*67e74705SXin Li StructWithProperty sp;
330*67e74705SXin Li sp.V8;
331*67e74705SXin Li sp.V8 = 0; // expected-error {{no setter defined for property 'V8'}}
332*67e74705SXin Li int i = sp.V11;
333*67e74705SXin Li sp.V11 = i++;
334*67e74705SXin Li sp.V11 += 8;
335*67e74705SXin Li sp.V11++;
336*67e74705SXin Li ++sp.V11;
337*67e74705SXin Li }
338*67e74705SXin Li
339*67e74705SXin Li //expected-warning@+1 {{C++ operator 'and' (aka '&&') used as a macro name}}
340*67e74705SXin Li #define and foo
341*67e74705SXin Li
342*67e74705SXin Li struct __declspec(uuid("00000000-0000-0000-C000-000000000046")) __declspec(novtable) IUnknown {};
343*67e74705SXin Li
344*67e74705SXin Li typedef bool (__stdcall __stdcall *blarg)(int);
345*67e74705SXin Li
346*67e74705SXin Li void local_callconv() {
347*67e74705SXin Li bool (__stdcall *p)(int);
348*67e74705SXin Li }
349*67e74705SXin Li
350*67e74705SXin Li struct S7 {
351*67e74705SXin Li int foo() { return 12; }
352*67e74705SXin Li __declspec(property(get=foo) deprecated) int t; // expected-note {{'t' has been explicitly marked deprecated here}}
353*67e74705SXin Li };
354*67e74705SXin Li
355*67e74705SXin Li // Technically, this is legal (though it does nothing)
356*67e74705SXin Li __declspec() void quux( void ) {
357*67e74705SXin Li struct S7 s;
358*67e74705SXin Li int i = s.t; // expected-warning {{'t' is deprecated}}
359*67e74705SXin Li }
360*67e74705SXin Li
361*67e74705SXin Li void *_alloca(int);
362*67e74705SXin Li
363*67e74705SXin Li void foo(void) {
364*67e74705SXin Li __declspec(align(16)) int *buffer = (int *)_alloca(9);
365*67e74705SXin Li }
366*67e74705SXin Li
367*67e74705SXin Li template <int *>
368*67e74705SXin Li struct NullptrArg {};
369*67e74705SXin Li NullptrArg<nullptr> a;
370*67e74705SXin Li
371*67e74705SXin Li // Ignored type qualifiers after comma in declarator lists
372*67e74705SXin Li typedef int ignored_quals_dummy1, const volatile __ptr32 __ptr64 __w64 __unaligned __sptr __uptr ignored_quals1; // expected-warning {{qualifiers after comma in declarator list are ignored}}
373*67e74705SXin Li typedef void(*ignored_quals_dummy2)(), __fastcall ignored_quals2; // expected-warning {{qualifiers after comma in declarator list are ignored}}
374*67e74705SXin Li typedef void(*ignored_quals_dummy3)(), __stdcall ignored_quals3; // expected-warning {{qualifiers after comma in declarator list are ignored}}
375*67e74705SXin Li typedef void(*ignored_quals_dummy4)(), __thiscall ignored_quals4; // expected-warning {{qualifiers after comma in declarator list are ignored}}
376*67e74705SXin Li typedef void(*ignored_quals_dummy5)(), __cdecl ignored_quals5; // expected-warning {{qualifiers after comma in declarator list are ignored}}
377*67e74705SXin Li typedef void(*ignored_quals_dummy6)(), __vectorcall ignored_quals6; // expected-warning {{qualifiers after comma in declarator list are ignored}}
378*67e74705SXin Li
379*67e74705SXin Li namespace {
380*67e74705SXin Li bool f(int);
381*67e74705SXin Li template <typename T>
382*67e74705SXin Li struct A {
383*67e74705SXin Li constexpr A(T t) {
384*67e74705SXin Li __assume(f(t)); // expected-warning{{the argument to '__assume' has side effects that will be discarded}}
385*67e74705SXin Li }
386*67e74705SXin Li constexpr bool g() { return false; }
387*67e74705SXin Li };
388*67e74705SXin Li constexpr A<int> h() {
389*67e74705SXin Li A<int> b(0); // expected-note {{in instantiation of member function}}
390*67e74705SXin Li return b;
391*67e74705SXin Li }
392*67e74705SXin Li static_assert(h().g() == false, "");
393*67e74705SXin Li }
394*67e74705SXin Li
395*67e74705SXin Li namespace {
396*67e74705SXin Li __declspec(align(16)) struct align_before_key1 {};
397*67e74705SXin Li __declspec(align(16)) struct align_before_key2 {} align_before_key2_var;
398*67e74705SXin Li __declspec(align(16)) struct align_before_key3 {} *align_before_key3_var;
399*67e74705SXin Li static_assert(__alignof(struct align_before_key1) == 16, "");
400*67e74705SXin Li static_assert(__alignof(struct align_before_key2) == 16, "");
401*67e74705SXin Li static_assert(__alignof(struct align_before_key3) == 16, "");
402*67e74705SXin Li }
403*67e74705SXin Li
404*67e74705SXin Li namespace PR24027 {
405*67e74705SXin Li struct S {
406*67e74705SXin Li template <typename T>
407*67e74705SXin Li S(T);
408*67e74705SXin Li } f([] {});
409*67e74705SXin Li }
410