llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-clang Author: Krystian Stasiowski (sdkrystian) <details> <summary>Changes</summary> Fixes [this bug](https://github.com/llvm/llvm-project/pull/90152#issuecomment-2100932093) caused by #<!-- -->90152. Will add tests shortly. --- Full diff: https://github.com/llvm/llvm-project/pull/91503.diff 1 Files Affected: - (modified) clang/lib/Sema/SemaDeclCXX.cpp (+12-5) ``````````diff diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp index 157d42c09cfcd..91c83564b567e 100644 --- a/clang/lib/Sema/SemaDeclCXX.cpp +++ b/clang/lib/Sema/SemaDeclCXX.cpp @@ -12963,14 +12963,15 @@ NamedDecl *Sema::BuildUsingDeclaration( return nullptr; } - DeclContext *LookupContext = computeDeclContext(SS); NestedNameSpecifierLoc QualifierLoc = SS.getWithLocInContext(Context); - if (!LookupContext || EllipsisLoc.isValid()) { - NamedDecl *D; + DeclContext *LookupContext = computeDeclContext(SS); + + auto BuildDependent = [&] { + NamedDecl *D = nullptr; // Dependent scope, or an unexpanded pack if (!LookupContext && CheckUsingDeclQualifier(UsingLoc, HasTypenameKeyword, SS, NameInfo, IdentLoc)) - return nullptr; + return D; if (HasTypenameKeyword) { // FIXME: not all declaration name kinds are legal here @@ -12987,7 +12988,7 @@ NamedDecl *Sema::BuildUsingDeclaration( CurContext->addDecl(D); ProcessDeclAttributeList(S, D, AttrList); return D; - } + }; auto Build = [&](bool Invalid) { UsingDecl *UD = @@ -13002,6 +13003,9 @@ NamedDecl *Sema::BuildUsingDeclaration( auto BuildInvalid = [&]{ return Build(true); }; auto BuildValid = [&]{ return Build(false); }; + if (!LookupContext || EllipsisLoc.isValid()) + return BuildDependent(); + if (RequireCompleteDeclContext(SS, LookupContext)) return BuildInvalid(); @@ -13024,6 +13028,9 @@ NamedDecl *Sema::BuildUsingDeclaration( LookupQualifiedName(R, LookupContext); + if (R.wasNotFoundInCurrentInstantiation()) + return BuildDependent(); + // Validate the context, now we have a lookup if (CheckUsingDeclQualifier(UsingLoc, HasTypenameKeyword, SS, NameInfo, IdentLoc, &R)) `````````` </details> https://github.com/llvm/llvm-project/pull/91503 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits