[clang] [clang] Fix a bug with qualified name lookup into current instantiation (PR #73018)

Shafik Yaghmour via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 28 13:37:56 PST 2023


================
@@ -482,8 +481,23 @@ ParsedType Sema::getTypeName(const IdentifierInfo &II, SourceLocation NameLoc,
         }
       }
     }
-    // If typo correction failed or was not performed, fall through
-    [[fallthrough]];
+    Result.suppressDiagnostics();
+    return nullptr;
+  case LookupResult::NotFoundInCurrentInstantiation: {
+    if (AllowImplicitTypename == ImplicitTypenameContext::Yes) {
+      QualType T;
+      T = Context.getDependentNameType(ElaboratedTypeKeyword::None,
+                                       SS->getScopeRep(), &II);
+      TypeLocBuilder TLB;
+      DependentNameTypeLoc TL = TLB.push<DependentNameTypeLoc>(T);
+      TL.setElaboratedKeywordLoc(SourceLocation());
+      TL.setQualifierLoc(SS->getWithLocInContext(Context));
+      TL.setNameLoc(NameLoc);
+      return CreateParsedType(T, TLB.getTypeSourceInfo(Context, T));
+    }
+    Result.suppressDiagnostics();
----------------
shafik wrote:

We could also just do `[[fallthrough]];` at the end. I think that is fine.

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


More information about the cfe-commits mailing list