1 // RUN: %clang_cc1 %s -fsyntax-only -Wno-unused-value -Wmicrosoft -verify -fms-extensions
3 /* Microsoft attribute tests */
4 [repeatable][source_annotation_attribute( Parameter|ReturnValue )]
5 struct SA_Post{ SA_Post(); int attr; };
7 [returnvalue:SA_Post( attr=1)]
8 int foo1([SA_Post(attr=1)] void *param);
11 [returnvalue:SA_Post(attr=1)]
12 int foo2([SA_Post(attr=1)] void *param);
16 [returnvalue:SA_Post(attr=1)]
17 int foo3([SA_Post(attr=1)] void *param);
21 [returnvalue:SA_Post(attr=1)]
22 int foo5([SA_Post(attr=1)] void *param);
27 class_attr([SA_Pre(Null=SA_No,NullTerminated=SA_Yes)] int a)
36 __uuidof(0); // expected-error {{you need to include <guiddef.h> before using the '__uuidof' operator}}
44 unsigned char Data4[8];
47 struct __declspec(uuid(L"00000000-0000-0000-1234-000000000047")) uuid_attr_bad1 { };// expected-error {{'uuid' attribute requires parameter 1 to be a string}}
48 struct __declspec(uuid(3)) uuid_attr_bad2 { };// expected-error {{'uuid' attribute requires parameter 1 to be a string}}
49 struct __declspec(uuid("0000000-0000-0000-1234-0000500000047")) uuid_attr_bad3 { };// expected-error {{uuid attribute contains a malformed GUID}}
50 struct __declspec(uuid("0000000-0000-0000-Z234-000000000047")) uuid_attr_bad4 { };// expected-error {{uuid attribute contains a malformed GUID}}
51 struct __declspec(uuid("000000000000-0000-1234-000000000047")) uuid_attr_bad5 { };// expected-error {{uuid attribute contains a malformed GUID}}
55 struct __declspec(uuid("000000A0-0000-0000-C000-000000000046"))
57 struct struct_without_uuid { };
59 struct __declspec(uuid("000000A0-0000-0000-C000-000000000049"))
63 struct_with_uuid2 {} ;
67 struct_with_uuid var_with_uuid[1];
68 struct_without_uuid var_without_uuid[1];
70 __uuidof(struct_with_uuid);
71 __uuidof(struct_with_uuid2);
72 __uuidof(struct_without_uuid); // expected-error {{cannot call operator __uuidof on a type with no GUID}}
73 __uuidof(struct_with_uuid*);
74 __uuidof(struct_without_uuid*); // expected-error {{cannot call operator __uuidof on a type with no GUID}}
76 __uuidof(var_with_uuid);
77 __uuidof(var_without_uuid);// expected-error {{cannot call operator __uuidof on a type with no GUID}}
78 __uuidof(var_with_uuid[1]);
79 __uuidof(var_without_uuid[1]);// expected-error {{cannot call operator __uuidof on a type with no GUID}}
80 __uuidof(&var_with_uuid[1]);
81 __uuidof(&var_without_uuid[1]);// expected-error {{cannot call operator __uuidof on a type with no GUID}}
84 __uuidof(1);// expected-error {{cannot call operator __uuidof on a type with no GUID}}
98 template <class T, const GUID* g = &__uuidof(T)>
99 class COM_CLASS_TEMPLATE { };
101 typedef COM_CLASS_TEMPLATE<struct_with_uuid, &__uuidof(struct_with_uuid)> COM_TYPE_1;
102 typedef COM_CLASS_TEMPLATE<struct_with_uuid> COM_TYPE_2;
104 template <class T, const GUID& g>
105 class COM_CLASS_TEMPLATE_REF { };
106 typedef COM_CLASS_TEMPLATE<struct_with_uuid, __uuidof(struct_with_uuid)> COM_TYPE_REF;
111 CtorCall& operator=(const CtorCall& that);
116 CtorCall& CtorCall::operator=(const CtorCall& that)
119 this->CtorCall::~CtorCall();
120 this->CtorCall::CtorCall(that); // expected-warning {{explicit constructor calls are a Microsoft extension}}
135 typename C1<T>:: /*template*/ Iterator<0> Mypos; // expected-warning {{use 'template' keyword to treat 'Iterator' as a dependent template name}}
140 typename C1<T>:: /*template*/ Iterator<0> Mypos; // expected-warning {{use 'template' keyword to treat 'Iterator' as a dependent template name}}
148 void redundant_typename() {
149 typename T t;// expected-warning {{expected a qualified name after 'typename'}}
150 typename AAAA a;// expected-warning {{expected a qualified name after 'typename'}}
155 redundant_typename<int>();
160 __interface MicrosoftInterface;
161 __interface MicrosoftInterface {
162 virtual void foo1() = 0;
163 virtual void foo2() = 0;
166 __int64 x7 = __int64(0);