[repeatable][source_annotation_attribute( Parameter|ReturnValue )]
struct SA_Post{ SA_Post(); int attr; };
[returnvalue:SA_Post( attr=1)]
int foo1([SA_Post(attr=1)] void *param);
namespace {
[returnvalue:SA_Post(attr=1)]
int foo2([SA_Post(attr=1)] void *param);
}
class T {
[returnvalue:SA_Post(attr=1)]
int foo3([SA_Post(attr=1)] void *param);
};
extern "C" {
[returnvalue:SA_Post(attr=1)]
int foo5([SA_Post(attr=1)] void *param);
}
class class_attr {
public:
class_attr([SA_Pre(Null=SA_No,NullTerminated=SA_Yes)] int a)
{
}
};
void uuidof_test1()
{
__uuidof(0);
}
typedef struct _GUID
{
unsigned long Data1;
unsigned short Data2;
unsigned short Data3;
unsigned char Data4[8];
} GUID;
struct __declspec(uuid(L"00000000-0000-0000-1234-000000000047")) uuid_attr_bad1 { };struct __declspec(uuid(3)) uuid_attr_bad2 { };struct __declspec(uuid("0000000-0000-0000-1234-0000500000047")) uuid_attr_bad3 { };struct __declspec(uuid("0000000-0000-0000-Z234-000000000047")) uuid_attr_bad4 { };struct __declspec(uuid("000000000000-0000-1234-000000000047")) uuid_attr_bad5 { };[uuid("000000000000-0000-1234-000000000047")] struct uuid_attr_bad6 { };
__declspec(uuid("000000A0-0000-0000-C000-000000000046")) int i;
struct __declspec(uuid("000000A0-0000-0000-C000-000000000046"))
struct_with_uuid { };
struct struct_without_uuid { };
struct base {
int a;
};
struct derived : base {
[uuid("000000A0-0000-0000-C000-00000000004A")] using base::a; };
struct __declspec(uuid("000000A0-0000-0000-C000-000000000049"))
struct_with_uuid2;
[uuid("000000A0-0000-0000-C000-000000000049")] struct struct_with_uuid3;
struct
struct_with_uuid2 {} ;
enum __declspec(uuid("000000A0-0000-0000-C000-000000000046"))
enum_with_uuid { };
enum enum_without_uuid { };
int __declspec(uuid("000000A0-0000-0000-C000-000000000046")) inappropriate_uuid;
int uuid_sema_test()
{
struct_with_uuid var_with_uuid[1];
struct_without_uuid var_without_uuid[1];
__uuidof(struct_with_uuid);
__uuidof(struct_with_uuid2);
__uuidof(struct_with_uuid3);
__uuidof(struct_without_uuid); __uuidof(struct_with_uuid*);
__uuidof(struct_without_uuid*); __uuidof(struct_with_uuid[1]);
__uuidof(struct_with_uuid*[1]); __uuidof(const struct_with_uuid[1][1]);
__uuidof(const struct_with_uuid*[1][1]);
__uuidof(enum_with_uuid);
__uuidof(enum_without_uuid); __uuidof(enum_with_uuid*);
__uuidof(enum_without_uuid*); __uuidof(enum_with_uuid[1]);
__uuidof(enum_with_uuid*[1]); __uuidof(const enum_with_uuid[1][1]);
__uuidof(const enum_with_uuid*[1][1]);
__uuidof(var_with_uuid);
__uuidof(var_without_uuid); __uuidof(var_with_uuid[1]);
__uuidof(var_without_uuid[1]); __uuidof(&var_with_uuid[1]);
__uuidof(&var_without_uuid[1]);
__uuidof(0);
__uuidof(1);}
template <class T>
void template_uuid()
{
T expr;
__uuidof(T);
__uuidof(expr);
}
template <class T, const GUID* g = &__uuidof(T)> class COM_CLASS_TEMPLATE { };
typedef COM_CLASS_TEMPLATE<struct_with_uuid, &*&__uuidof(struct_with_uuid)> COM_TYPE_1; typedef COM_CLASS_TEMPLATE<struct_with_uuid> COM_TYPE_2;
template <class T, const GUID& g>
class COM_CLASS_TEMPLATE_REF { };
typedef COM_CLASS_TEMPLATE_REF<struct_with_uuid, __uuidof(struct_with_uuid)> COM_TYPE_REF;
struct late_defined_uuid;
template<typename T>
void test_late_defined_uuid() {
__uuidof(late_defined_uuid);
}
struct __declspec(uuid("000000A0-0000-0000-C000-000000000049")) late_defined_uuid;
COM_CLASS_TEMPLATE_REF<int, __uuidof(struct_with_uuid)> good_template_arg;
COM_CLASS_TEMPLATE<int, __uuidof(struct_with_uuid)> bad_template_arg;
namespace PR16911 {
struct __declspec(uuid("{12345678-1234-1234-1234-1234567890aB}")) uuid;
struct __declspec(uuid("{12345678-1234-1234-1234-1234567890aB}")) uuid2;
template <typename T, typename T2>
struct thing {
};
struct empty {};
struct inher : public thing<empty, uuid2> {};
struct __declspec(uuid("{12345678-1234-1234-1234-1234567890aB}")) uuid;
const struct _GUID *w = &__uuidof(inher); const struct _GUID *x = &__uuidof(thing<uuid, inher>);
const struct _GUID *y = &__uuidof(thing<uuid2, uuid>); thing<uuid2, uuid> thing_obj = thing<uuid2, uuid>();
const struct _GUID *z = &__uuidof(thing_obj); }
class CtorCall {
public:
CtorCall& operator=(const CtorCall& that);
int a;
};
CtorCall& CtorCall::operator=(const CtorCall& that)
{
if (this != &that) {
this->CtorCall::~CtorCall();
this->CtorCall::CtorCall(that); }
return *this;
}
template <class A>
class C1 {
public:
template <int B>
class Iterator {
};
};
template<class T>
class C2 {
typename C1<T>:: Iterator<0> Mypos; };
template <class T>
void missing_template_keyword(){
typename C1<T>:: Iterator<0> Mypos; }
class AAAA {
typedef int D;
};
template <typename T>
class SimpleTemplate {};
template <class T>
void redundant_typename() {
typename T t; typename AAAA a;
t = 3;
typedef typename T* pointerT; typedef typename SimpleTemplate<int> templateT;
pointerT pT = &t;
*pT = 4;
int var;
int k = typename var;}
template <typename T>
struct TypenameWrongPlace {
typename typedef T::D D;};
extern TypenameWrongPlace<AAAA> PR16925;
__interface MicrosoftInterface;
__interface MicrosoftInterface {
void foo1() = 0; virtual void foo2() = 0;
};
__interface MicrosoftDerivedInterface : public MicrosoftInterface {
void foo1(); void foo2() override;
void foo3();
};
void interface_test() {
MicrosoftInterface* a;
a->foo1();
MicrosoftDerivedInterface* b;
b->foo2();
}
__int64 x7 = __int64(0);
_int64 x8 = _int64(0);
static_assert(sizeof(_int64) == 8, "");
static_assert(sizeof(_int32) == 4, "");
static_assert(sizeof(_int16) == 2, "");
static_assert(sizeof(_int8) == 1, "");
int __identifier(generic) = 3;
int __identifier(int) = 4;
struct __identifier(class) { __identifier(class) *__identifier(for); };
__identifier(class) __identifier(struct) = { &__identifier(struct) };
int __identifier for; int __identifier(else} = __identifier(for); #define identifier_weird(x) __identifier(x
int k = identifier_weird(if));
extern int __identifier(and);
int __identifier("baz") = 0;
int bar = baz;
void mangled_function();
extern "C" void __identifier("?mangled_function@@YAXXZ")() {}
void f() {
__identifier(() __identifier(void) __identifier()) __identifier(1) __identifier(+) __identifier(;) __identifier("1"); __identifier("+"); __identifier(";"); }
class inline_definition_pure_spec {
virtual int f() = 0 { return 0; } virtual int f2() = 0;
};
struct pure_virtual_dtor {
virtual ~pure_virtual_dtor() = 0;
};
pure_virtual_dtor::~pure_virtual_dtor() { }
struct pure_virtual_dtor_inline {
virtual ~pure_virtual_dtor_inline() = 0 { }};
template<typename T> struct pure_virtual_dtor_template {
virtual ~pure_virtual_dtor_template() = 0;
};
template<typename T> pure_virtual_dtor_template<T>::~pure_virtual_dtor_template() {}
template struct pure_virtual_dtor_template<int>;
template<typename T> struct pure_virtual_dtor_template_inline {
virtual ~pure_virtual_dtor_template_inline() = 0 {}
};
template struct pure_virtual_dtor_template_inline<int>;
int main () {
test_late_defined_uuid<int>();
redundant_typename<int>();
missing_template_keyword<int>();
}
namespace access_protected_PTM {
class A {
protected:
void f(); };
class B : public A{
public:
void test_access();
static void test_access_static();
};
void B::test_access() {
&A::f; }
void B::test_access_static() {
&A::f;
}
}
namespace Inheritance {
class __single_inheritance A;
class __multiple_inheritance B;
class __virtual_inheritance C;
}
struct StructWithProperty {
__declspec(property) int V0; __declspec(property()) int V1; __declspec(property(set)) int V2; __declspec(property(ptu)) int V3; __declspec(property(ptu=PutV)) int V4; __declspec(property(get)) int V5; __declspec(property(get&)) int V6; __declspec(property(get=)) int V7; __declspec(property(get=GetV)) int V8; __declspec(property(get=GetV=)) int V9; __declspec(property(get=GetV,)) int V10; __declspec(property(get=GetV,put=SetV)) int V11; __declspec(property(get=GetV,put=SetV,get=GetV)) int V12; __declspec(property(get=GetV)) int V13 = 3;
int GetV() { return 123; }
void SetV(int v) {}
};
void TestProperty() {
StructWithProperty sp;
sp.V8;
sp.V8 = 0; int i = sp.V11;
sp.V11 = i++;
sp.V11 += 8;
sp.V11++;
++sp.V11;
}
#define and foo
struct __declspec(uuid("00000000-0000-0000-C000-000000000046")) __declspec(novtable) IUnknown {};
typedef bool (__stdcall __stdcall *blarg)(int);
void local_callconv() {
bool (__stdcall *p)(int);
}
struct S7 {
int foo() { return 12; }
__declspec(property(get=foo) deprecated) int t; };
__declspec() void quux( void ) {
struct S7 s;
int i = s.t; }
void *_alloca(int);
void foo(void) {
__declspec(align(16)) int *buffer = (int *)_alloca(9);
}
template <int *>
struct NullptrArg {};
NullptrArg<nullptr> a;
typedef int ignored_quals_dummy1, const volatile __ptr32 __ptr64 __w64 __unaligned __sptr __uptr ignored_quals1; typedef void(*ignored_quals_dummy2)(), __fastcall ignored_quals2; typedef void(*ignored_quals_dummy3)(), __stdcall ignored_quals3; typedef void(*ignored_quals_dummy4)(), __thiscall ignored_quals4; typedef void(*ignored_quals_dummy5)(), __cdecl ignored_quals5; typedef void(*ignored_quals_dummy6)(), __vectorcall ignored_quals6;
namespace {
bool f(int);
template <typename T>
struct A {
constexpr A(T t) {
__assume(f(t)); }
constexpr bool g() { return false; }
};
constexpr A<int> h() {
A<int> b(0); return b;
}
static_assert(h().g() == false, "");
}
namespace {
__declspec(align(16)) struct align_before_key1 {};
__declspec(align(16)) struct align_before_key2 {} align_before_key2_var;
__declspec(align(16)) struct align_before_key3 {} *align_before_key3_var;
static_assert(__alignof(struct align_before_key1) == 16, "");
static_assert(__alignof(struct align_before_key2) == 16, "");
static_assert(__alignof(struct align_before_key3) == 16, "");
}
namespace PR24027 {
struct S {
template <typename T>
S(T);
} f([] {});
}
namespace pr36638 {
struct A;
void (A::*mp1)(int) __unaligned;
}
namespace enum_class {
enum E0 *p0; enum class E1 : int *p1;
enum E2 : int *p2;
enum class E3 *p3;
auto f4() -> enum class E4 { return {}; }
auto f5() -> enum E5 : int { return {}; } auto f6() -> enum E6 { return {}; }
enum E {};
struct S {
enum E : int(1); enum E : int : 1; enum F : int a = {}; enum E : int : int{}{}; };
}