1 // RUN: %clang_cc1 -std=c++1y -fms-extensions -emit-llvm %s -o - -triple=i386-pc-win32 | FileCheck %s
2 
3 template <typename> int x = 0;
4 
5 // CHECK: "\01??$x@X@@3HA"
6 template <> int x<void>;
7 // CHECK: "\01??$x@H@@3HA"
8 template <> int x<int>;
9 
10 // CHECK: "\01?FunctionWithLocalType@@YA?A?<auto>@@XZ"
FunctionWithLocalType()11 auto FunctionWithLocalType() {
12   struct LocalType {};
13   return LocalType{};
14 }
15 
16 // CHECK: "\01?ValueFromFunctionWithLocalType@@3ULocalType@?1??FunctionWithLocalType@@YA?A?<auto>@@XZ@A"
17 auto ValueFromFunctionWithLocalType = FunctionWithLocalType();
18 
19 // CHECK: "\01??R<lambda_0>@@QBE?A?<auto>@@XZ"
__anona8a24f0b0102null20 auto LambdaWithLocalType = [] {
21   struct LocalType {};
22   return LocalType{};
23 };
24 
25 // CHECK: "\01?ValueFromLambdaWithLocalType@@3ULocalType@?1???R<lambda_0>@@QBE?A?<auto>@@XZ@A"
26 auto ValueFromLambdaWithLocalType = LambdaWithLocalType();
27 
28 template <typename T>
TemplateFuncionWithLocalLambda(T)29 auto TemplateFuncionWithLocalLambda(T) {
30   auto LocalLambdaWithLocalType = []() {
31     struct LocalType {};
32     return LocalType{};
33   };
34   return LocalLambdaWithLocalType();
35 }
36 
37 // CHECK: "\01?ValueFromTemplateFuncionWithLocalLambda@@3ULocalType@?2???R<lambda_1>@??$TemplateFuncionWithLocalLambda@H@@YA?A?<auto>@@H@Z@QBA?A?3@XZ@A"
38 // CHECK: "\01??$TemplateFuncionWithLocalLambda@H@@YA?A?<auto>@@H@Z"
39 // CHECK: "\01??R<lambda_1>@??$TemplateFuncionWithLocalLambda@H@@YA?A?<auto>@@H@Z@QBA?A?1@XZ"
40 auto ValueFromTemplateFuncionWithLocalLambda = TemplateFuncionWithLocalLambda(0);
41