https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120012

--- Comment #6 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-15 branch has been updated by Jason Merrill
<ja...@gcc.gnu.org>:

https://gcc.gnu.org/g:809c5d7486f91d59e798e0c70ac887f837039ece

commit r15-9635-g809c5d7486f91d59e798e0c70ac887f837039ece
Author: Jason Merrill <ja...@redhat.com>
Date:   Wed Apr 30 10:18:46 2025 -0400

    c++: C++17/20 class layout divergence [PR120012]

    C++20 made a class with only explicitly defaulted constructors no longer
    aggregate, and this wrongly affected whether the class is considered "POD
    for layout purposes" under the ABI.

    Conveniently, we already have check_non_pod_aggregate to diagnose cases
    where this makes a difference, due to PR103681 around a C++14 aggregate
    change.

    This backport is the same code change as the trunk version, but since
    -fabi-version=21 cannot be selected, the fix is not available, only the
    warning, so the first testcase is different.

            PR c++/120012

    gcc/cp/ChangeLog:

            * cp-tree.h (struct lang_type): Add non_aggregate_pod.
            (CLASSTYPE_NON_AGGREGATE_POD): New.
            * class.cc (check_bases_and_members): Set it.
            (check_non_pod_aggregate): Diagnose it.

    gcc/testsuite/ChangeLog:

            * g++.dg/abi/base-defaulted1.C: New test.
            * g++.dg/abi/base-defaulted1a.C: New test.

    (cherry picked from commit e6e3b0772ed40cc65a544bbe744ece62d8b9713e)

Reply via email to