[clang] [Clang] Implement resolution for CWG1835 (PR #92957)

Matheus Izvekov via cfe-commits cfe-commits at lists.llvm.org
Tue May 21 20:57:54 PDT 2024


================
@@ -397,22 +397,32 @@ NamedDecl *Sema::FindFirstQualifierInScope(Scope *S, NestedNameSpecifier *NNS) {
   while (NNS->getPrefix())
     NNS = NNS->getPrefix();
 
-  if (NNS->getKind() != NestedNameSpecifier::Identifier)
-    return nullptr;
-
-  LookupResult Found(*this, NNS->getAsIdentifier(), SourceLocation(),
-                     LookupNestedNameSpecifierName);
+  // FIXME: This is a rather nasty hack! Ideally we should get the results
+  // from LookupTemplateName/BuildCXXNestedNameSpecifier.
+  const IdentifierInfo *II = NNS->getAsIdentifier();
+  if (!II) {
+    if (const auto *DTST =
+            dyn_cast_if_present<DependentTemplateSpecializationType>(
+                NNS->getAsType()))
+      II = DTST->getIdentifier();
+    else
+      return nullptr;
+  }
----------------
mizvekov wrote:

I am not sure why you think this is a nasty hack, this looks legitimate to me.

I think this looks ugly because of the lack of a NNS kind for an Identifier with template arguments, so we abuse a type kind storing a DependentTemplateSpecializationType with no qualifier.

https://github.com/llvm/llvm-project/pull/92957


More information about the cfe-commits mailing list