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

--- Comment #3 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:0552560f6d2eaa1ae6df5c80660b489de1d5c772

commit r14-9372-g0552560f6d2eaa1ae6df5c80660b489de1d5c772
Author: Patrick Palka <ppa...@redhat.com>
Date:   Thu Mar 7 16:23:22 2024 -0500

    c++/modules: inline namespace abi_tag streaming [PR110730]

    The unreduced testcase from PR110730 crashes at runtime ultimately
    because we don't stream the abi_tag attribute on inline namespaces and
    so the filesystem::current_path() call resolves to the non-C++11 ABI
    version even though the C++11 ABI is active, leading to a crash when
    destroying the path temporary (which contains an std::string member).
    Similar story for the PR105512 testcase.

    While we do stream the DECL_ATTRIBUTES of all decls that go through
    the generic tree streaming routines, it seems namespaces are streamed
    separately from other decls and we don't use the generic routines for
    them.  So this patch makes us stream the abi_tag manually for (inline)
    namespaces.

            PR c++/110730
            PR c++/105512

    gcc/cp/ChangeLog:

            * module.cc (module_state::write_namespaces): Stream the
            abi_tag attribute of an inline namespace.
            (module_state::read_namespaces): Likewise.

    gcc/testsuite/ChangeLog:

            * g++.dg/modules/hello-2_a.C: New test.
            * g++.dg/modules/hello-2_b.C: New test.
            * g++.dg/modules/namespace-6_a.H: New test.
            * g++.dg/modules/namespace-6_b.C: New test.

    Reviewed-by: Jason Merrill <ja...@redhat.com>

Reply via email to