[PATCH] D145034: [Clang][Sema] Start fixing handling of out-of-line definitions of constrained templates

Alexander Shaposhnikov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 9 21:52:48 PST 2023


alexander-shaposhnikov added inline comments.


================
Comment at: clang/lib/Sema/SemaCXXScopeSpec.cpp:141
+              ClassTemplate->getInjectedClassNameSpecialization();
+          if (Context.hasSameType(Injected, ContextType))
+            return ClassTemplate->getTemplatedDecl();
----------------
rsmith wrote:
> alexander-shaposhnikov wrote:
> > rsmith wrote:
> > > This should also be guarded by a check that `TemplateParameterListsAreEqual` between `ClassTemplate->getTemplateParameters()` and the template parameter list we picked out of the given array of template parameter lists.
> > > 
> > > (With that check in place, we can move this back before the search for partial specializations.)
> > The problem is that currently the template parameter list (the one which we are supposed to pick above) is not always present,
> > thus the fallback and this check are both still necessary. It happens e.g. for invalid code and if i remove the fallback it triggers more changes to the diagnostic output, other than that there might be more cases where we currently don't set TemplateParamLists for CXXScopeSpec, i kinda wanted to move incrementally.
> OK. Can we do the check in the case where we do have a list of template parameter lists, at least, or does that also cause more diagnostic disruption than you'd like to deal with in this change?
heh, unfortunately it does, in particular, the examples in the namespace "bad" in CXX/drs/dr5xx.cpp would be disrupted


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D145034/new/

https://reviews.llvm.org/D145034



More information about the llvm-commits mailing list