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

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

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

commit r15-11089-gf6aa67e5cffad440c9486f1832a79750f1c89dc0
Author: Marek Polacek <[email protected]>
Date:   Wed Apr 15 14:15:06 2026 -0400

    c++: ICE with deleted main [PR120338]

    Here we ICE with deleted main which is later redefined at

      gcc_assert (DECL_SAVED_TREE (fn));

    because for some reason when deleting main I chose NULL_TREE instead of
    error_mark_node as its DECL_INITIAL.  For other deleted functions we
    also use error_mark_node so that

      void foo() = delete;
      void foo() {}

    results in the "redefinition of" error.  Let's do the same for main, then.

            PR c++/120338

    gcc/cp/ChangeLog:

            * decl.cc (cp_finish_decl): Set DECL_INITIAL to error_mark_node
            instead of NULL_TREE for deleted main.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp0x/deleted19.C: New test.

    Reviewed-by: Jason Merrill <[email protected]>
    (cherry picked from commit 77d4080e1e5f9d467816e2e2e878edbfbb7ee1c1)
  • [Bug c++/120338] [15 regression... cvs-commit at gcc dot gnu.org via Gcc-bugs

Reply via email to