https://github.com/aalmkainzi updated https://github.com/llvm/llvm-project/pull/229940
>From 436f8b22de7b271ccc92fd4db860d3aaf31bdbbb Mon Sep 17 00:00:00 2001 From: Abdulmalek Almkainzi <[email protected]> Date: Thu, 8 Oct 2026 01:46:30 +0300 Subject: [PATCH 1/3] only attempting to evaluate if !isValueDependent() --- clang/lib/Sema/SemaInit.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/clang/lib/Sema/SemaInit.cpp b/clang/lib/Sema/SemaInit.cpp index 3f30e94aa8976..402fb11eaae14 100644 --- a/clang/lib/Sema/SemaInit.cpp +++ b/clang/lib/Sema/SemaInit.cpp @@ -8581,6 +8581,7 @@ ExprResult InitializationSequence::Perform(Sema &S, // respectively. Expr::EvalResult ER; if (Entity.getType()->getAs<PointerType>() && + !CurInit.get()->isValueDependent() && CurInit.get()->EvaluateAsRValue(ER, S.Context) && (ER.Val.isLValue() && !ER.Val.isNullPointer())) { S.Diag(Kind.getLocation(), diag::err_c23_constexpr_pointer_not_null); >From 24b6e0d0f3b45a99fd73c037a8ff6233a5dd2cd5 Mon Sep 17 00:00:00 2001 From: Abdulmalek Almkainzi <[email protected]> Date: Thu, 8 Oct 2026 02:13:43 +0300 Subject: [PATCH 2/3] added test --- clang/test/Sema/constexpr.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/clang/test/Sema/constexpr.c b/clang/test/Sema/constexpr.c index 0a9b5724a8343..3bb8cffe16ab2 100644 --- a/clang/test/Sema/constexpr.c +++ b/clang/test/Sema/constexpr.c @@ -470,3 +470,6 @@ struct S2 { const struct S2 s2[2] = {{{"foo"}, 1}, [0].L[2] = 'x'}; // expected-warning {{initializer partially overrides prior initialization of this subobject}} \ // expected-note {{previous initialization is here}} static_assert(s2[0].L[2] == 'x');// expected-warning {{folding it to a constant is a GNU extension}} + +x y; // expected-error{{unknown type name 'x'}} +constexpr int *p = (int*){y}; >From d0e29009fce49624d636353561f7b9587409f3ce Mon Sep 17 00:00:00 2001 From: aalmkainzi <[email protected]> Date: Thu, 8 Oct 2026 15:12:18 +0300 Subject: [PATCH 3/3] added release note --- clang/docs/ReleaseNotes.md | 1 + 1 file changed, 1 insertion(+) diff --git a/clang/docs/ReleaseNotes.md b/clang/docs/ReleaseNotes.md index bac1ce6dc4553..996530201ddea 100644 --- a/clang/docs/ReleaseNotes.md +++ b/clang/docs/ReleaseNotes.md @@ -645,6 +645,7 @@ features cannot lower the translation-unit ABI level; - Fixed assertion failures caused by stale linkage information when an extern variable or function declaration is merged with a preceding static declaration. (#GH204759, #GH204754) - Fixed a crash due to typo correction mishandling custom keywords `_virtual_inheritance` and `_multiple_inheritance` in `-fms-compatibility` mode. (#GH228003) - Clang no longer treats a file-scope `thread_local` declaration without an initializer as a tentative definition in C23 mode. As specified by C23 6.9.3, such a declaration is a definition, so declaring the same variable more that once is now diagnosed as a redefinition. (#GH217636) +- Fixed failed assertion when creating a compound literal with erroneous initializer at file scope. (#GH229888) #### Bug Fixes to Compiler Builtins _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
