]> granicus.if.org Git - clang/commitdiff
For PR43213, track whether template parameters are implicit through
authorRichard Smith <richard-llvm@metafoo.co.uk>
Wed, 4 Sep 2019 22:14:50 +0000 (22:14 +0000)
committerRichard Smith <richard-llvm@metafoo.co.uk>
Wed, 4 Sep 2019 22:14:50 +0000 (22:14 +0000)
template instantiation so we know whether to mangle them in
lambda-expressions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@370991 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaTemplateInstantiateDecl.cpp
test/CodeGenCXX/mangle-lambda-explicit-template-params.cpp

index 6e4f9b99478fcc44ff757409c8a246b445651de7..5ef16b4a3751fe61e3dfc9d27d71ac0c13287422 100644 (file)
@@ -2337,6 +2337,7 @@ Decl *TemplateDeclInstantiator::VisitTemplateTypeParmDecl(
       D->getDepth() - TemplateArgs.getNumSubstitutedLevels(), D->getIndex(),
       D->getIdentifier(), D->wasDeclaredWithTypename(), D->isParameterPack());
   Inst->setAccess(AS_public);
+  Inst->setImplicit(D->isImplicit());
 
   if (D->hasDefaultArgument() && !D->defaultArgumentWasInherited()) {
     TypeSourceInfo *InstantiatedDefaultArg =
@@ -2483,6 +2484,7 @@ Decl *TemplateDeclInstantiator::VisitNonTypeTemplateParmDecl(
         D->getPosition(), D->getIdentifier(), T, D->isParameterPack(), DI);
 
   Param->setAccess(AS_public);
+  Param->setImplicit(D->isImplicit());
   if (Invalid)
     Param->setInvalidDecl();
 
@@ -2626,6 +2628,7 @@ TemplateDeclInstantiator::VisitTemplateTemplateParmDecl(
                               D->getDefaultArgument().getTemplateNameLoc()));
   }
   Param->setAccess(AS_public);
+  Param->setImplicit(D->isImplicit());
 
   // Introduce this template parameter's instantiation into the instantiation
   // scope.
index 3bec64156a9dba2c1e4528a36368dbb2f286fabb..b88b0d56fd99e151abe4aaff81c0f2ba43f9b2f5 100644 (file)
@@ -32,3 +32,10 @@ inline void inline_func() {
 void call_inline_func() {
   inline_func();
 }
+
+template<typename> void f() {
+  // CHECK: define linkonce_odr {{.*}} @_ZZ1fIiEvvENKUlT_E_clIiEEDaS0_(
+  auto x = [](auto){};
+  x(0);
+}
+void use_f() { f<int>(); }