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

            Bug ID: 122840
           Summary: ICE when defining 'main' after 'int main() = delete'
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Keywords: error-recovery, ice-checking, ice-on-invalid-code
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: attackerj1113 at gmail dot com
  Target Milestone: ---

The following code causes ICE out on x86-64 gcc since version 15.1(assertions)
and reproducible on trunk:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
int main() = delete;
int main() {}

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Please check https://godbolt.org/z/s6rnTq5bc

Compiler Output:

<source>:1:14: error: '::main' cannot be deleted
    1 | int main() = delete;
      |              ^~~~~~
<source>:2:13: internal compiler error: in expand_or_defer_fn_1, at
cp/semantics.cc:5534
    2 | int main() {}
      |             ^
0x2913268 diagnostics::context::diagnostic_impl(rich_location*,
diagnostics::metadata const*, diagnostics::option_id, char const*,
__va_list_tag (*) [1], diagnostics::kind)
        ???:0
0x290802b internal_error(char const*, ...)
        ???:0
0xb0e9ec fancy_abort(char const*, int, char const*)
        ???:0
0xdd3c5e expand_or_defer_fn(tree_node*)
        ???:0
0xd4ab63 c_parse_file()
        ???:0
0xeba679 c_common_parse_file()
        ???:0
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
Compiler returned: 1
  • [Bug c++/122840] New: ICE when... attackerj1113 at gmail dot com via Gcc-bugs

Reply via email to