[Bug c++/100234] New: [11/12 Regression] Coroutines ICE

jakub at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Apr 23 15:39:28 GMT 2021


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

            Bug ID: 100234
           Summary: [11/12 Regression] Coroutines ICE
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jakub at gcc dot gnu.org
  Target Milestone: ---

Starting with r11-2183-g0f66b8486cea8668020e4bd48f261b760cb579be
the following testcase ICEs with -std=c++20 -fcoroutines:
rh1952671.C: In member function ‘K L::bar()’:
rh1952671.C:44:41: internal compiler error: tree check: expected record_type or
union_type or qual_union_type, have array_type in build_special_member_call, at
cp/call.c:9758
   44 |   K bar () { co_await foo (C(), {C()}); }
      |                                         ^
0x1a5f2ac tree_check_failed(tree_node const*, char const*, int, char const*,
...)
        ../../gcc/tree.c:9687
0x958126 tree_check3(tree_node*, char const*, int, char const*, tree_code,
tree_code, tree_code)
        ../../gcc/tree.h:3343
0x94b8b3 build_special_member_call(tree_node*, tree_node*, vec<tree_node*,
va_gc, vl_embed>**, tree_node*, int, int)
        ../../gcc/cp/call.c:9758
0x9d8490 flatten_await_stmt
        ../../gcc/cp/coroutines.cc:2859

namespace std {
template <class> class initializer_list {
  int *a;
  decltype(sizeof 0) b;
};
}
struct C { C(); };
struct D { D(std::initializer_list<C>); };
namespace std {
template <typename e, typename> struct coroutine_traits : e {};
template <typename = void> struct coroutine_handle {
  operator coroutine_handle<>();
};
}
struct F {
  void await_ready();
  void await_suspend(std::coroutine_handle<>);
  void await_resume();
};
struct M {
  void await_ready() noexcept;
  template <typename h> void await_suspend(h) noexcept;
  void await_resume() noexcept;
};
struct I {
  F initial_suspend();
  auto final_suspend() noexcept { return M{}; }
};
struct K {
  struct J : public I {
    void unhandled_exception();
//    K get_return_object() { return K{}; }
  };
  using promise_type = J;
};
struct Q {
  Q(int);
  void await_ready();
  void await_resume();
  void await_suspend(std::coroutine_handle<>);
};
Q foo (C, D);
struct L {
  K bar () { co_await foo (C(), {C()}); }
};

while before that commit it has been rejected with
rh1952671.C: In member function ‘K L::bar()’:
rh1952671.C:44:5: error: no member named ‘get_return_object’ in
‘K::promise_type’ {aka ‘K::J’}
   44 |   K bar () { co_await foo (C(), {C()}); }
      |     ^~~


More information about the Gcc-bugs mailing list