https://gcc.gnu.org/g:5cc8f727a1cb70b5e6dc1c4363b5ce67375002e6
commit r15-11264-g5cc8f727a1cb70b5e6dc1c4363b5ce67375002e6 Author: Jason Merrill <[email protected]> Date: Fri Jun 5 11:18:49 2026 -0400 Revert "c++: constexpr nested empty objects [PR125315]" This reverts commit 92f35736ebf9c6d24622e129c5ebac71bafcedd5. Diff: --- gcc/cp/constexpr.cc | 7 +------ gcc/testsuite/g++.dg/cpp2a/no_unique_address16.C | 10 ---------- 2 files changed, 1 insertion(+), 16 deletions(-) diff --git a/gcc/cp/constexpr.cc b/gcc/cp/constexpr.cc index 59c1b31fa0b2..2935d24211d0 100644 --- a/gcc/cp/constexpr.cc +++ b/gcc/cp/constexpr.cc @@ -5439,12 +5439,7 @@ init_subob_ctx (const constexpr_ctx *ctx, constexpr_ctx &new_ctx, else if (ctx->object) ctxtype = TREE_TYPE (ctx->object); else - { - /* This can happen if the enclosing object is also an empty subobject - (c++/125315). */ - gcc_checking_assert (is_empty_class (type)); - return; - } + gcc_unreachable (); if (VECTOR_TYPE_P (type) && VECTOR_TYPE_P (ctxtype) diff --git a/gcc/testsuite/g++.dg/cpp2a/no_unique_address16.C b/gcc/testsuite/g++.dg/cpp2a/no_unique_address16.C deleted file mode 100644 index 22c0b699f926..000000000000 --- a/gcc/testsuite/g++.dg/cpp2a/no_unique_address16.C +++ /dev/null @@ -1,10 +0,0 @@ -// PR c++/125315 -// { dg-do compile { target c++20 } } -// { dg-prune-output "used but never defined" } - -struct S{~S(){}}; -constexpr S& f(S& t); -struct W{[[no_unique_address]]S v;}; -struct R:W{}; -S s; -auto x=R{{f(s)}};
