[clang] [Clang] No longer reject call expression whose type is a not-yet-deduced auto type. (PR #208007)
Corentin Jabot via cfe-commits
cfe-commits at lists.llvm.org
Tue Jul 7 07:18:28 PDT 2026
https://github.com/cor3ntin created https://github.com/llvm/llvm-project/pull/208007
This fixes a regression introduced in #139246
Fixes #207565
>From 08094558013891236b1292b759a1fa95577ca66b Mon Sep 17 00:00:00 2001
From: Corentin Jabot <corentinjabot at gmail.com>
Date: Tue, 7 Jul 2026 16:03:35 +0200
Subject: [PATCH] [Clang] No longer reject call expression whose type is a
not-yet-deduced auto type.
This fixes a regression introduced in #139246
Fixes #207565
---
clang/docs/ReleaseNotes.md | 1 +
clang/lib/Sema/SemaExpr.cpp | 2 +-
clang/test/SemaTemplate/fun-template-def.cpp | 13 +++++++++++++
3 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/clang/docs/ReleaseNotes.md b/clang/docs/ReleaseNotes.md
index 77b6f89e39f83..f534d2d780d21 100644
--- a/clang/docs/ReleaseNotes.md
+++ b/clang/docs/ReleaseNotes.md
@@ -795,6 +795,7 @@ latest release, please see the [Clang Web Site](https://clang.llvm.org) or the
- Fixed a preprocessor assertion failure triggered when parsing an invalid template-id starting with `::template operator`. (#GH186582)
- Fixed a crash when a function template is defined as a non-template friend with a global scope qualifier. (#GH185341)
- Clang now rejects constant template parameters with block pointer types, since these are not implemented anyway and would lead to crashes. (#GH189247)
+- Clang no longer reject call expressions whose type is a not-yet-deduced auto type. (#GH207565)
- Fixed a crash on error recovery when dealing with invalid templates. (#GH183075)
- Fixed a crash when instantiating `requires` expressions involving substitution failures in C++ concepts. (#GH176402)
- Concepts appearing in the require-clause of a member function no longer have access to non-public members of that class,
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index 592cb1d588370..39c565b5a112c 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -6828,7 +6828,7 @@ static bool MayBeFunctionType(const ASTContext &Context, const Expr *E) {
T == Context.BuiltinFnTy || T == Context.OverloadTy ||
T->isFunctionType() || T->isFunctionReferenceType() ||
T->isMemberFunctionPointerType() || T->isFunctionPointerType() ||
- T->isBlockPointerType() || T->isRecordType())
+ T->isBlockPointerType() || T->isRecordType() || T->isUndeducedType())
return true;
return isa<CallExpr, DeclRefExpr, MemberExpr, CXXPseudoDestructorExpr,
diff --git a/clang/test/SemaTemplate/fun-template-def.cpp b/clang/test/SemaTemplate/fun-template-def.cpp
index e21ca624f4d01..b0d0580d5ba80 100644
--- a/clang/test/SemaTemplate/fun-template-def.cpp
+++ b/clang/test/SemaTemplate/fun-template-def.cpp
@@ -109,6 +109,19 @@ auto k = c_<1>; // expected-note {{in instantiation of variable}}
}
+namespace GH207565 {
+ template <auto... Cs> struct S {
+ static constexpr auto cl = [](auto... args) { return (..., (Cs(), args)); };
+ static constexpr auto cl2 = []() { return (..., Cs()); }; // expected-error {{called object type 'int' is not a function or function pointer}} \
+ // expected-note {{while substituting into a lambda expression here}}
+};
+
+template struct S<>;
+template struct S<1>; // expected-note {{in instantiation}}
+
+}
+
+
#endif
#if __cplusplus >= 201702L
More information about the cfe-commits
mailing list