1 // RUN: %clang_cc1 -emit-llvm %s -o - -triple x86_64-unknown-unknown -fms-extensions | FileCheck %s
2 // rdar://17784718
3 
4 typedef struct _GUID
5 {
6     unsigned int  Data1;
7     unsigned short Data2;
8     unsigned short Data3;
9     unsigned char  Data4[ 8 ];
10 } GUID;
11 
12 
13 template < typename T, const GUID & T_iid = __uuidof(T)>
14 class UUIDTest
15 {
16 public:
17 	UUIDTest() { }
18 };
19 
20 struct __declspec(uuid("EAFA1952-66F8-438B-8FBA-AF1BBAE42191")) TestStruct
21 {
22 	int foo;
23 };
24 
25 template <class T> void test_uuidofType(void *arg[sizeof(__uuidof(T))] = 0) {}
26 
27 template <class T> void test_uuidofExpr(void *arg[sizeof(__uuidof(T::member))] = 0) {}
28 
29 struct HasMember { typedef TestStruct member; };
30 
31 int main(int argc, const char * argv[])
32 {
33 
34     UUIDTest<TestStruct> uuidof_test;
35     test_uuidofType<TestStruct>();
36     test_uuidofExpr<HasMember>();
37     return 0;
38 }
39 
40 // CHECK: define i32 @main
41 // CHECK: call void @_ZN8UUIDTestI10TestStructXu8__uuidoftS0_EEC1Ev
42 // CHECK: call void @_Z15test_uuidofTypeI10TestStructEvPPv(i8** null)
43 // CHECK: call void @_Z15test_uuidofExprI9HasMemberEvPPv(i8** null)
44 
45 // CHECK: define linkonce_odr void @_ZN8UUIDTestI10TestStructXu8__uuidoftS0_EEC1Ev
46 // CHECK: define linkonce_odr void @_Z15test_uuidofTypeI10TestStructEvPPv
47 // CHECK: define linkonce_odr void @_Z15test_uuidofExprI9HasMemberEvPPv
48 // CHECK: define linkonce_odr void @_ZN8UUIDTestI10TestStructXu8__uuidoftS0_EEC2Ev
49