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

--- Comment #2 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Simon Martin <[email protected]>:

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

commit r16-6883-ge3bb887b3ee2baf118a67082c2bed2c8cc262875
Author: Simon Martin <[email protected]>
Date:   Sun Jan 18 11:07:10 2026 +0100

    c++: don't crash determining linkage of invalid TYPE_DECL [PR122391]

    We currently ICE in decl_linkage for the following invalid input
    because we access the TYPE_MAIN_VARIANT of error_mark_node

    ===
    extern "C" {
      template <a> class b;
      struct {
        typedef b:
    ===

    This patch fixes this by returning no linkage for any TYPE_DECL with an
    erroneous type.

            PR c++/122391

    gcc/cp/ChangeLog:

            * tree.cc (decl_linkage): Return lk_none for TYPE_DECLs with
            erroneous type.

    gcc/testsuite/ChangeLog:

            * g++.dg/parse/bitfield10.C: New test.

Reply via email to