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

            Bug ID: 123553
           Summary: internal compiler error: crash at cp/coroutines.cc:
                    coro_promise_type_found_p: templated promise
                    return_value/return_void yields OVERLOAD
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Keywords: 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 on x86-64 gcc on trunk:


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#include <coroutine>
struct A {
  struct promise_type {
    template<class = void> void return_value(int) {}
    template<class = void> void return_void() {}
  };
};

A f() { co_return 1; }

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Please check  https://godbolt.org/z/azrjxMbcT

Compiler Output:

<source>: In function 'A f()':
<source>:16:3: error: the coroutine promise type
'std::__n4861::__coroutine_traits_impl<A, void>::promise_type' {aka
'A::promise_type'} declares both 'return_value' and 'return_void'
   16 | A f() { co_return 1; }
      |   ^
<source>:16:19: internal compiler error: tree check: expected tree that
contains 'decl minimal' structure, have 'overload' in
coro_promise_type_found_p, at cp/coroutines.cc:840
   16 | A f() { co_return 1; }
      |                   ^
0x2926688 diagnostics::context::diagnostic_impl(rich_location*,
diagnostics::metadata const*, diagnostics::option_id, char const*,
__va_list_tag (*) [1], diagnostics::kind)
        ???:0
0x291b44b internal_error(char const*, ...)
        ???:0
0xa1b84e tree_contains_struct_check_failed(tree_node const*,
tree_node_structure_enum, char const*, int, char const*)
        ???:0
0xbb148a finish_co_return_stmt(unsigned long, tree_node*)
        ???:0
0xd57563 c_parse_file()
        ???:0
0xec8ee9 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

Reply via email to