https://gcc.gnu.org/g:95f8b83be752aed9469d832aafff717012be3f36
commit r14-12639-g95f8b83be752aed9469d832aafff717012be3f36 Author: Jason Merrill <[email protected]> Date: Mon Jun 8 02:58:33 2026 -0400 Revert "c++: constexpr nested empty objects [PR125315]" This reverts commit 53d01c24a921ae9b6edd21d2f07dd28565944c2b. 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 7ab9e7383009..55086b930e73 100644 --- a/gcc/cp/constexpr.cc +++ b/gcc/cp/constexpr.cc @@ -5292,12 +5292,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)}};
