1 // RUN: %clang_cc1 -std=c++1y -fms-extensions -emit-llvm %s -o - -triple=i386-pc-win32 -fms-compatibility-version=19.00 | FileCheck %s --check-prefix=CHECK --check-prefix=MSVC2015
2 // RUN: %clang_cc1 -std=c++1y -fms-extensions -emit-llvm %s -o - -triple=i386-pc-win32 -fms-compatibility-version=18.00 | FileCheck %s --check-prefix=CHECK --check-prefix=MSVC2013
3
4 template <typename> int x = 0;
5
6 // CHECK-DAG: "\01??$x@X@@3HA"
7 template <> int x<void>;
8 // CHECK-DAG: "\01??$x@H@@3HA"
9 template <> int x<int>;
10
11 // CHECK-DAG: "\01?FunctionWithLocalType@@YA?A?<auto>@@XZ"
FunctionWithLocalType()12 auto FunctionWithLocalType() {
13 struct LocalType {};
14 return LocalType{};
15 }
16
17 // CHECK-DAG: "\01?ValueFromFunctionWithLocalType@@3ULocalType@?1??FunctionWithLocalType@@YA?A?<auto>@@XZ@A"
18 auto ValueFromFunctionWithLocalType = FunctionWithLocalType();
19
20 // CHECK-DAG: "\01??R<lambda_0>@@QBE?A?<auto>@@XZ"
__anone099d9010102null21 auto LambdaWithLocalType = [] {
22 struct LocalType {};
23 return LocalType{};
24 };
25
26 // CHECK-DAG: "\01?ValueFromLambdaWithLocalType@@3ULocalType@?1???R<lambda_0>@@QBE?A?<auto>@@XZ@A"
27 auto ValueFromLambdaWithLocalType = LambdaWithLocalType();
28
29 template <typename T>
TemplateFuncionWithLocalLambda(T)30 auto TemplateFuncionWithLocalLambda(T) {
31 auto LocalLambdaWithLocalType = []() {
32 struct LocalType {};
33 return LocalType{};
34 };
35 return LocalLambdaWithLocalType();
36 }
37
38 // MSVC2013-DAG: "\01?ValueFromTemplateFuncionWithLocalLambda@@3ULocalType@?2???R<lambda_1>@?0???$TemplateFuncionWithLocalLambda@H@@YA?A?<auto>@@H@Z@QBE?A?3@XZ@A"
39 // MSVC2013-DAG: "\01?ValueFromTemplateFuncionWithLocalLambda@@3ULocalType@?2???R<lambda_1>@?0???$TemplateFuncionWithLocalLambda@H@@YA?A?<auto>@@H@Z@QBE?A?3@XZ@A"
40 // MSVC2015-DAG: "\01?ValueFromTemplateFuncionWithLocalLambda@@3ULocalType@?1???R<lambda_1>@?0???$TemplateFuncionWithLocalLambda@H@@YA?A?<auto>@@H@Z@QBE?A?3@XZ@A"
41 // MSVC2015-DAG: "\01?ValueFromTemplateFuncionWithLocalLambda@@3ULocalType@?1???R<lambda_1>@?0???$TemplateFuncionWithLocalLambda@H@@YA?A?<auto>@@H@Z@QBE?A?3@XZ@A"
42 // CHECK-DAG: "\01??$TemplateFuncionWithLocalLambda@H@@YA?A?<auto>@@H@Z"
43 // CHECK-DAG: "\01??R<lambda_1>@?0???$TemplateFuncionWithLocalLambda@H@@YA?A?<auto>@@H@Z@QBE?A?1@XZ"
44 auto ValueFromTemplateFuncionWithLocalLambda = TemplateFuncionWithLocalLambda(0);
45
46 struct S;
47 template <int S::*>
48 int WithPMD = 0;
49
50 template <> int WithPMD<nullptr>;
51 // CHECK-DAG: "\01??$WithPMD@$GA@A@?0@@3HA"
52
53 template <const int *, const int *>
54 struct Foo {};
55
56 Foo<&x<int>, &x<int>> Zoo;
57 // CHECK-DAG: "\01?Zoo@@3U?$Foo@$1??$x@H@@3HA$1?1@3HA@@A"
58
59 template <typename T> T unaligned_x;
test_unaligned()60 extern auto test_unaligned() { return unaligned_x<int __unaligned *>; }
61 // CHECK-DAG: "\01??$unaligned_x@PFAH@@3PFAHA"
62
63