Author: Corentin Jabot Date: 2026-07-08T10:02:39+02:00 New Revision: 475f7026055c77007d19c708ed13465a4206dfee
URL: https://github.com/llvm/llvm-project/commit/475f7026055c77007d19c708ed13465a4206dfee DIFF: https://github.com/llvm/llvm-project/commit/475f7026055c77007d19c708ed13465a4206dfee.diff LOG: [Clang] No longer reject call expression whose type is a not-yet-deduced auto type. (#208007) This fixes a regression introduced in #139246 Fixes #207565 Added: Modified: clang/docs/ReleaseNotes.md clang/lib/Sema/SemaExpr.cpp clang/test/SemaTemplate/fun-template-def.cpp Removed: ################################################################################ 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 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
