Skip to content

Commit 71c37a8

Browse files
committed
For PR43213, track whether template parameters are implicit through
template instantiation so we know whether to mangle them in lambda-expressions. llvm-svn: 370991
1 parent 44ca0c5 commit 71c37a8

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

clang/lib/Sema/SemaTemplateInstantiateDecl.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2337,6 +2337,7 @@ Decl *TemplateDeclInstantiator::VisitTemplateTypeParmDecl(
23372337
D->getDepth() - TemplateArgs.getNumSubstitutedLevels(), D->getIndex(),
23382338
D->getIdentifier(), D->wasDeclaredWithTypename(), D->isParameterPack());
23392339
Inst->setAccess(AS_public);
2340+
Inst->setImplicit(D->isImplicit());
23402341

23412342
if (D->hasDefaultArgument() && !D->defaultArgumentWasInherited()) {
23422343
TypeSourceInfo *InstantiatedDefaultArg =
@@ -2483,6 +2484,7 @@ Decl *TemplateDeclInstantiator::VisitNonTypeTemplateParmDecl(
24832484
D->getPosition(), D->getIdentifier(), T, D->isParameterPack(), DI);
24842485

24852486
Param->setAccess(AS_public);
2487+
Param->setImplicit(D->isImplicit());
24862488
if (Invalid)
24872489
Param->setInvalidDecl();
24882490

@@ -2626,6 +2628,7 @@ TemplateDeclInstantiator::VisitTemplateTemplateParmDecl(
26262628
D->getDefaultArgument().getTemplateNameLoc()));
26272629
}
26282630
Param->setAccess(AS_public);
2631+
Param->setImplicit(D->isImplicit());
26292632

26302633
// Introduce this template parameter's instantiation into the instantiation
26312634
// scope.

clang/test/CodeGenCXX/mangle-lambda-explicit-template-params.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,10 @@ inline void inline_func() {
3232
void call_inline_func() {
3333
inline_func();
3434
}
35+
36+
template<typename> void f() {
37+
// CHECK: define linkonce_odr {{.*}} @_ZZ1fIiEvvENKUlT_E_clIiEEDaS0_(
38+
auto x = [](auto){};
39+
x(0);
40+
}
41+
void use_f() { f<int>(); }

0 commit comments

Comments
 (0)