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

--- Comment #10 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Patrick Palka <ppa...@gcc.gnu.org>:

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

commit r14-8900-gf931bd7725f5cea948dd55ac370b5b9fd9a00198
Author: Patrick Palka <ppa...@redhat.com>
Date:   Fri Feb 9 12:40:28 2024 -0500

    c++/modules: anon union member of as-base class [PR112580]

    Here when streaming in the fields of the as-base version of
    _Formatting_scanner<int> we end up overwriting ANON_AGGR_TYPE_FIELD
    of the anonymous union type, since it turns out this type is shared
    between the original FIELD_DECL and the as-base FIELD_DECL copy (copied
    during layout_class_type).  ANON_AGGR_TYPE_FIELD first gets properly set
    to the original FIELD_DECL when streaming in the canonical definition of
    _Formatting_scanner<int>, and then gets overwritten to the as-base
    FIELD_DECL when streaming in the the as-base definition.  This leads to
    lookup_anon_field later giving the wrong answer when resolving the
    _M_values use at instantiation time.

    This patch makes us avoid overwriting ANON_AGGR_TYPE_FIELD when streaming
    in an as-base class definition; it should already be properly set at that
    point.

            PR c++/112580

    gcc/cp/ChangeLog:

            * module.cc (trees_in::read_class_def): When streaming in
            an anonymous union field of an as-base class, don't overwrite
            ANON_AGGR_TYPE_FIELD.

    gcc/testsuite/ChangeLog:

            * g++.dg/modules/anon-3_a.H: New test.
            * g++.dg/modules/anon-3_b.C: New test.

    Reviewed-by: Jason Merrill <ja...@redhat.com>
  • [Bug c++/112580] [14 Regression... cvs-commit at gcc dot gnu.org via Gcc-bugs

Reply via email to