From 55ea36002bd364518c20b3ce282640c920697bf7 Mon Sep 17 00:00:00 2001 From: Krystian Stasiowski Date: Tue, 6 Aug 2024 12:40:44 -0400 Subject: [Clang][Sema] Make UnresolvedLookupExprs in class scope explicit specializations instantiation dependent (#100392) A class member named by an expression in a member function that may instantiate to a static _or_ non-static member is represented by a `UnresolvedLookupExpr` in order to defer the implicit transformation to a class member access expression until instantiation. Since `ASTContext::getDecltypeType` only creates a `DecltypeType` that has a `DependentDecltypeType` as its canonical type when the operand is instantiation dependent, and since we do not transform types unless they are instantiation dependent, we need to mark the `UnresolvedLookupExpr` as instantiation dependent in order to correctly build a `DecltypeType` using the expression as its operand with a `DependentDecltypeType` canonical type. Fixes #99873. --- clang/lib/Sema/SemaExprMember.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'clang/lib/Sema/SemaExprMember.cpp') diff --git a/clang/lib/Sema/SemaExprMember.cpp b/clang/lib/Sema/SemaExprMember.cpp index 2070f3b..f1ba26f 100644 --- a/clang/lib/Sema/SemaExprMember.cpp +++ b/clang/lib/Sema/SemaExprMember.cpp @@ -331,7 +331,8 @@ ExprResult Sema::BuildPossibleImplicitMemberExpr( return UnresolvedLookupExpr::Create( Context, R.getNamingClass(), SS.getWithLocInContext(Context), TemplateKWLoc, R.getLookupNameInfo(), /*RequiresADL=*/false, - TemplateArgs, R.begin(), R.end(), /*KnownDependent=*/true); + TemplateArgs, R.begin(), R.end(), /*KnownDependent=*/true, + /*KnownInstantiationDependent=*/true); case IMA_Error_StaticOrExplicitContext: case IMA_Error_Unrelated: -- cgit v1.1