================
@@ -1157,26 +1156,32 @@ Sema::NameClassification Sema::ClassifyName(Scope *S,
CXXScopeSpec &SS,
IsFunctionTemplate = true;
Template = Context.getOverloadedTemplateName(Result.begin(),
Result.end());
- } else if (!Result.empty()) {
- auto *TD = cast<TemplateDecl>(getAsTemplateNameDecl(
- *Result.begin(), /*AllowFunctionTemplates=*/true,
- /*AllowDependent=*/false));
- IsFunctionTemplate = isa<FunctionTemplateDecl>(TD);
- IsVarTemplate = isa<VarTemplateDecl>(TD);
-
- UsingShadowDecl *FoundUsingShadow =
- dyn_cast<UsingShadowDecl>(*Result.begin());
- assert(!FoundUsingShadow ||
- TD == cast<TemplateDecl>(FoundUsingShadow->getTargetDecl()));
- Template = Context.getQualifiedTemplateName(
- SS.getScopeRep(),
- /*TemplateKeyword=*/false,
- FoundUsingShadow ? TemplateName(FoundUsingShadow) :
TemplateName(TD));
} else {
- // All results were non-template functions. This is a function template
- // name.
- IsFunctionTemplate = true;
- Template = Context.getAssumedTemplateName(NameInfo.getName());
+ TemplateDecl *TD = nullptr;
+ if (!Result.empty()) {
+ TD = dyn_cast_or_null<TemplateDecl>(getAsTemplateNameDecl(
+ *Result.begin(), /*AllowFunctionTemplates=*/true,
+ /*AllowDependent=*/false));
+ }
+
+ if (TD) {
----------------
erichkeane wrote:
Why is this a separate branch here? The layout here is silly, we have a single
branch/condition above that depends on this 'TD' too.
Also, why shouldn't be we be checking the `shadow decl` stuff below if this is
a 'using'/etc?
https://github.com/llvm/llvm-project/pull/190322
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits