[clang] Fix out of line Concept-comparisons of NestedNameSpecifiers (PR #65993)
Erich Keane via cfe-commits
cfe-commits at lists.llvm.org
Mon Sep 11 12:40:20 PDT 2023
================
@@ -231,14 +231,18 @@ Response HandleFunctionTemplateDecl(const FunctionTemplateDecl *FTD,
MultiLevelTemplateArgumentList &Result) {
if (!isa<ClassTemplateSpecializationDecl>(FTD->getDeclContext())) {
NestedNameSpecifier *NNS = FTD->getTemplatedDecl()->getQualifier();
- const Type *Ty;
- const TemplateSpecializationType *TSTy;
- if (NNS && (Ty = NNS->getAsType()) &&
- (TSTy = Ty->getAs<TemplateSpecializationType>()))
- Result.addOuterTemplateArguments(const_cast<FunctionTemplateDecl *>(FTD),
- TSTy->template_arguments(),
- /*Final=*/false);
+
+ while (const Type *Ty = NNS ? NNS->getAsType() : nullptr) {
----------------
erichkeane wrote:
So that one you're seeing there is for the `InnerClass` on line 13, the `NestedNameSpecifier` is for 'everything else' outside of that declaration. So in THAT case, the Prefix of that one is nothing, since the `Base<T>` is the entirety of the thing.
However, that AST doesn't show the `NNS` of `func` on line 22, for some reason we're not dumping that. In THAT case, the `NNS` is `Base<T>::InnerClass`. At that point, the `InnerClass` doesn't have template arguments (since it isn't a template!), but its `Prefix` is just the `Base<T>`, which has them (which is why/how this loop works).
https://github.com/llvm/llvm-project/pull/65993
More information about the cfe-commits
mailing list