https://github.com/Rinn updated https://github.com/llvm/llvm-project/pull/187755
>From bcaef3fd13529ca97e8babb931c56a640191d7ca Mon Sep 17 00:00:00 2001 From: Joe Kirchoff <[email protected]> Date: Fri, 20 Mar 2026 10:04:55 -0700 Subject: [PATCH 1/3] [clang] fix error cannot compile this l-value expression yet Prior to this clang will crash when __builtin_FUNCTION is passed to decltype() to be used as a template typename --- clang/lib/AST/Expr.cpp | 2 +- clang/test/CodeGenCXX/builtin_FUNCTION.cpp | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/clang/lib/AST/Expr.cpp b/clang/lib/AST/Expr.cpp index 185e887fb05c3..fa606eab5aa4e 100644 --- a/clang/lib/AST/Expr.cpp +++ b/clang/lib/AST/Expr.cpp @@ -2255,7 +2255,7 @@ SourceLocExpr::SourceLocExpr(const ASTContext &Ctx, SourceLocIdentKind Kind, SourceLocExprBits.Kind = llvm::to_underlying(Kind); // In dependent contexts, function names may change. setDependence(MayBeDependent(Kind) && ParentContext->isDependentContext() - ? ExprDependence::Value + ? ExprDependence::ValueInstantiation : ExprDependence::None); } diff --git a/clang/test/CodeGenCXX/builtin_FUNCTION.cpp b/clang/test/CodeGenCXX/builtin_FUNCTION.cpp index 44821b92d33fe..02d85239ec554 100644 --- a/clang/test/CodeGenCXX/builtin_FUNCTION.cpp +++ b/clang/test/CodeGenCXX/builtin_FUNCTION.cpp @@ -39,3 +39,20 @@ void do_default_arg_test() { } } // namespace test_func + +namespace test_decltype_template { + +template <typename> void template_func() {} + +// CHECK: define linkonce_odr {{(dso_local )?}}void @_ZN22test_decltype_template21use_decltype_templateIiEEvv( +// CHECK: call void @_ZN22test_decltype_template13template_funcIPKcEEvv() +template <typename> void use_decltype_template() { + template_func<decltype(__builtin_FUNCTION())>(); +} + +// CHECK: define linkonce_odr {{(dso_local )?}}void @_ZN22test_decltype_template13template_funcIPKcEEvv() +void do_decltype_template_test() { + use_decltype_template<int>(); +} + +} // namespace test_decltype_template >From 714e2eebb9d514276176f99ff1fc98b9be040173 Mon Sep 17 00:00:00 2001 From: Joe Kirchoff <[email protected]> Date: Fri, 20 Mar 2026 14:49:37 -0700 Subject: [PATCH 2/3] Update ReleaseNotes.rst --- clang/docs/ReleaseNotes.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst index 45234c316eba8..29afb69abf36f 100644 --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -402,6 +402,7 @@ Miscellaneous Clang Crashes Fixed - Fixed a crash when subscripting a vector type with large unsigned integer values. (#GH180563) - Fixed a crash when evaluating ``__is_bitwise_cloneable`` on invalid record types. (#GH183707) - Fixed an assertion failure when casting a function pointer with a target with a non-default program address space. (#GH186210) +- Fixed a crash when ``__builtin_FUNCTION()`` is passed to ``decltype()`` when used as a template type argument. (#GH167433) OpenACC Specific Changes ------------------------ >From 96bbc8d560450995ce8d0a1adfd956976e4b11cb Mon Sep 17 00:00:00 2001 From: Joe Kirchoff <[email protected]> Date: Fri, 20 Mar 2026 14:51:57 -0700 Subject: [PATCH 3/3] Update ReleaseNotes.rst --- clang/docs/ReleaseNotes.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst index 29afb69abf36f..b13171f7ecafc 100644 --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -402,7 +402,7 @@ Miscellaneous Clang Crashes Fixed - Fixed a crash when subscripting a vector type with large unsigned integer values. (#GH180563) - Fixed a crash when evaluating ``__is_bitwise_cloneable`` on invalid record types. (#GH183707) - Fixed an assertion failure when casting a function pointer with a target with a non-default program address space. (#GH186210) -- Fixed a crash when ``__builtin_FUNCTION()`` is passed to ``decltype()`` when used as a template type argument. (#GH167433) +- Fixed a crash when ``decltype(__builtin_FUNCTION())`` is used as a template type argument. (#GH167433) OpenACC Specific Changes ------------------------ _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
