Mercurial > hg > CbC > CbC_llvm
comparison clang/test/SemaCXX/ms-uuid.cpp @ 173:0572611fdcc8 llvm10 llvm12
reorgnization done
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 25 May 2020 11:55:54 +0900 |
parents | 1d019706d866 |
children |
comparison
equal
deleted
inserted
replaced
172:9fbae9c8bf63 | 173:0572611fdcc8 |
---|---|
1 // RUN: %clang_cc1 -fsyntax-only -verify -fms-extensions %s -Wno-deprecated-declarations | 1 // RUN: %clang_cc1 -fsyntax-only -verify -fms-extensions %s -Wno-deprecated-declarations |
2 // RUN: %clang_cc1 -fsyntax-only -std=c++17 -verify -fms-extensions %s -Wno-deprecated-declarations | 2 // RUN: %clang_cc1 -fsyntax-only -std=c++17 -verify -fms-extensions %s -Wno-deprecated-declarations |
3 | 3 |
4 typedef struct _GUID { | 4 typedef struct _GUID { |
5 unsigned long Data1; | 5 __UINT32_TYPE__ Data1; |
6 unsigned short Data2; | 6 __UINT16_TYPE__ Data2; |
7 unsigned short Data3; | 7 __UINT16_TYPE__ Data3; |
8 unsigned char Data4[8]; | 8 __UINT8_TYPE__ Data4[8]; |
9 } GUID; | 9 } GUID; |
10 | 10 |
11 namespace { | 11 namespace { |
12 // cl.exe's behavior with merging uuid attributes is a bit erratic: | 12 // cl.exe's behavior with merging uuid attributes is a bit erratic: |
13 // * In []-style attributes, a single [] list must not list a duplicate uuid | 13 // * In []-style attributes, a single [] list must not list a duplicate uuid |
110 // Test class/struct redeclaration where the subsequent | 110 // Test class/struct redeclaration where the subsequent |
111 // declaration has a uuid attribute | 111 // declaration has a uuid attribute |
112 struct X{}; | 112 struct X{}; |
113 | 113 |
114 struct __declspec(uuid("00000000-0000-0000-0000-000000000000")) X; | 114 struct __declspec(uuid("00000000-0000-0000-0000-000000000000")) X; |
115 | |
116 namespace ConstantEvaluation { | |
117 class __declspec(uuid("1babb1ed-feed-c01d-1ced-decafc0ffee5")) Request; | |
118 constexpr GUID a = __uuidof(Request); | |
119 static_assert(a.Data1 == 0x1babb1ed, ""); | |
120 static_assert(__uuidof(Request).Data1 == 0x1babb1ed, ""); | |
121 static_assert(a.Data2 == 0xfeed, ""); | |
122 static_assert(__uuidof(Request).Data2 == 0xfeed, ""); | |
123 static_assert(a.Data3 == 0xc01d, ""); | |
124 static_assert(__uuidof(Request).Data3 == 0xc01d, ""); | |
125 static_assert(a.Data4[0] == 0x1c, ""); | |
126 static_assert(__uuidof(Request).Data4[0] == 0x1c, ""); | |
127 static_assert(a.Data4[1] == 0xed, ""); | |
128 static_assert(__uuidof(Request).Data4[1] == 0xed, ""); | |
129 static_assert(a.Data4[2] == 0xde, ""); | |
130 static_assert(__uuidof(Request).Data4[2] == 0xde, ""); | |
131 static_assert(a.Data4[7] == 0xe5, ""); | |
132 static_assert(__uuidof(Request).Data4[7] == 0xe5, ""); | |
133 constexpr int k = __uuidof(Request).Data4[8]; // expected-error {{constant expression}} expected-note {{past-the-end}} | |
134 } |