Skip to content

Commit 9c1c221

Browse files
authored
[Clang] Correctly handle callees whose type is a Record type when classifying expressions (llvm#68078)
when the callee is an object. When implementing deducing this, we changed `DeduceTemplateArgumentsFromCallArgument` to take an argument classification because we need to deduce the type of argument for which we might not have an expression yet. However classifying a dependent call expression whose type is just some sort of record or elaborated type was not supported. Fixes llvm#68024
1 parent 2da99a1 commit 9c1c221

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

clang/lib/AST/Expr.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1621,6 +1621,10 @@ QualType CallExpr::getCallReturnType(const ASTContext &Ctx) const {
16211621
// This should never be overloaded and so should never return null.
16221622
CalleeType = Expr::findBoundMemberType(Callee);
16231623
assert(!CalleeType.isNull());
1624+
} else if (CalleeType->isRecordType()) {
1625+
// If the Callee is a record type, then it is a not-yet-resolved
1626+
// dependent call to the call operator of that type.
1627+
return Ctx.DependentTy;
16241628
} else if (CalleeType->isDependentType() ||
16251629
CalleeType->isSpecificPlaceholderType(BuiltinType::Overload)) {
16261630
return Ctx.DependentTy;

clang/test/SemaTemplate/temp_arg_nontype_cxx1z.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -603,3 +603,15 @@ namespace PR47792 {
603603
template void bar<>(); // expected-note {{previous explicit instantiation is here}}
604604
template void bar<foo>(); // expected-error {{duplicate explicit instantiation of 'bar<&PR47792::foo>'}}
605605
}
606+
607+
namespace GH68024 {
608+
template<auto>
609+
struct s {};
610+
611+
struct {
612+
void operator()(int);
613+
} f;
614+
615+
template<typename T>
616+
using a = s<f(T::x)>;
617+
}

0 commit comments

Comments
 (0)