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

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

https://gcc.gnu.org/g:e6e3b0772ed40cc65a544bbe744ece62d8b9713e

commit r16-355-ge6e3b0772ed40cc65a544bbe744ece62d8b9713e
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.

            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/ChangeLog:

            * doc/invoke.texi: Document C++20 aggregate fix.
            * common.opt: Likewise.

    gcc/testsuite/ChangeLog:

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

Reply via email to