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

--- Comment #11 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Marek Polacek <[email protected]>:

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

commit r17-5510-gd91e9e992cf8edf7dfcbe5a2d1f4cb05a66d7640
Author: Marek Polacek <[email protected]>
Date:   Tue Oct 13 14:54:57 2026 -0400

    c++/reflection: use OPAQUE_TYPE for std::meta::info

    Currently, we use the LANG_TYPE node to represent the C++ Reflection
    type std::meta::info.  Unfortunately that doesn't work too well with
    streaming for LTO, see 126017.  Another problem was that the
    std::meta::info LANG_TYPE wasn't marked
    TYPE_CONTAINS_PLACEHOLDER_INTERNAL (127856).  Jakub suggested changing
    LANG_TYPE to OPAQUE_TYPE.  OPAQUE_TYPE was introduced in GCC 11 for
    PowerPC MMA __vector_pair/__vector_quad types.  Its description reads as
    pretty much what we want for std::meta::info.  One difference between
    the PowerPC MMA types and std::meta::info is that the latter has a
    scalar integer mode instead of MODE_OPAQUE, so it's possible to
    distinguish between them.

    I've checked rs6000_mangle_type and I don't think it needs any changes.

    Using OPAQUE_TYPE fixes both the LTO crashes and 127856.

            PR c++/126017
            PR c++/127856

    gcc/cp/ChangeLog:

            * cxx-pretty-print.cc (cxx_pretty_printer::simple_type_specifier)
            <case LANG_TYPE>: Rename to OPAQUE_TYPE.
            (cxx_pretty_printer::type_id) <case LANG_TYPE>: Likewise.
            * mangle.cc (write_type) <case LANG_TYPE>: Likewise.
            * module.cc (trees_out::type_node) <case LANG_TYPE>: Likewise.
            (trees_in::tree_node) <case LANG_TYPE>: Likewise.
            * name-lookup.cc (name_lookup::adl_type) <case LANG_TYPE>:
            Don't check REFLECTION_TYPE_P here.
            <case OPAQUE_TYPE>: New.
            * reflect.cc (init_reflection): Create an OPAQUE_TYPE node instead
            of a LANG_TYPE node.
            * tree.cc (type_has_unique_obj_representations) <case LANG_TYPE>:
            Rename to OPAQUE_TYPE.

    gcc/ChangeLog:

            * doc/generic.texi: Update OPAQUE_TYPE description.
            * dwarf2out.cc (gen_type_die_with_usage) <case OPAQUE_TYPE>: If
            SCALAR_INT_MODE_P, goto unspecified_type.
            * tree.cc (wide_int_to_tree_1) <case LANG_TYPE>: Rename to
            OPAQUE_TYPE.  Assert SCALAR_INT_MODE_P.
            (cache_integer_cst) <case LANG_TYPE>: Likewise.
            (verify_opaque_type): Allow SCALAR_INT_MODE_P mode.
            * tree.def (OPAQUE_TYPE): Update description.

    gcc/testsuite/ChangeLog:

            * g++.dg/reflect/diag6.C: Adjust expected diagnostic.
            * g++.dg/reflect/init2.C: Likewise.
            * g++.dg/lto/pr126017_0.C: New test.
            * g++.dg/lto/pr126017_1.C: New test.
            * g++.dg/reflect/pr127856.C: New test.
            * g++.target/powerpc/reflection1.C: New test.

    Co-authored-by: Jakub Jelinek <[email protected]>
    Reviewed-by: Jason Merrill <[email protected]>
  • [Bug c++/126017] internal compi... cvs-commit at gcc dot gnu.org via Gcc-bugs

Reply via email to