[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
Wed Jul 8 00:52:18 PDT 2026
https://github.com/cor3ntin updated https://github.com/llvm/llvm-project/pull/208007
>From d6a01a1776f4af93f8abf43559e12d129a046e3d 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 e12ae0b2eeed4..4d7d9f2909096 100644
--- a/clang/docs/ReleaseNotes.md
+++ b/clang/docs/ReleaseNotes.md
@@ -815,6 +815,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 274973c78da81..e5b1926787c20 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