vsapsai added a comment.

Does your fix work for deeper nesting too (e.g. template in template in 
template)? Looks like it should, just want to confirm.

Are there other places where you need to avoid calling 
`DeduceTemplateArguments` due to templates depth mismatch? 
`CheckDependentFunctionTemplateSpecialization` should be OK as it's not 
deducing template arguments. But I'm not sure about 
`CheckMemberSpecialization`. It doesn't call `DeduceTemplateArguments` directly 
but I haven't dug deep enough to confirm it's not performing deduction 
indirectly.



================
Comment at: lib/Sema/SemaDecl.cpp:8307-8308
         isFunctionTemplateSpecialization = true;
+        if (Invalid && TemplateParams->getLAngleLoc().isInvalid())
+          HasFabricatedTemplateSpecializationTemplateParams = true;
         // For source fidelity, store all the template param lists.
----------------
Checking if angle location is invalid looks suspicious. It can be my lack of 
knowledge but I expect various locations not to convey sema information.


================
Comment at: lib/Sema/SemaDecl.cpp:8880-8881
           << NewFD->getDeclName();
-      } else if (CheckFunctionTemplateSpecialization(NewFD,
+      } else if (!HasFabricatedTemplateSpecializationTemplateParams &&
+                 CheckFunctionTemplateSpecialization(NewFD,
                                   (HasExplicitTemplateArgs ? &TemplateArgs
----------------
Will something more general like

    !NewFD->isInvalidDecl() && CheckFunctionTemplateSpecialization(...)

work here? Because if matching template parameters to scope specifier fails, 
`NewFD` is marked as invalid decl and seems like we can use that.


Repository:
  rL LLVM

https://reviews.llvm.org/D37341



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
  • [PATCH] D37341: [Sema] Fi... Alex Lorenz via Phabricator via cfe-commits
    • [PATCH] D37341: [Sem... Volodymyr Sapsai via Phabricator via cfe-commits

Reply via email to