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

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |10.3
            Summary|internal compiler error:    |ICE tree check: expected
                   |tree check: expected        |record_type or union_type
                   |record_type or union_type   |or qual_union_type, have
                   |or qual_union_type, have    |array_type in
                   |array_type in               |build_special_member_call,
                   |build_special_member_call,  |at cp/call.c:9862 since
                   |at cp/call.c:9862           |r11-2183-g0f66b8486cea8668

--- Comment #3 from Martin Liška <marxin at gcc dot gnu.org> ---
Before r11-2183-g0f66b8486cea8668 it was rejected.

Reduced test-case:

$ cat cloudstorage.cc.ii
namespace std {
template <typename _Result, typename...> struct coroutine_traits : _Result {};
template <typename = void> struct coroutine_handle {
  operator coroutine_handle<>();
};
struct suspend_never {
  void await_ready();
  void await_suspend(coroutine_handle<>);
  void await_resume();
};
} // namespace std
namespace std_ns = std;
namespace coro::stdx {
template <typename...> using coroutine_handle = std_ns::coroutine_handle<>;
}
namespace std {
struct pair {
  template <typename _U1, typename _U2> pair(_U1, _U2);
};
template <class> class initializer_list {
  int *_M_array;
  unsigned long _M_len;
};
int typedef string;
} // namespace std
namespace coro::stdx {
class stop_token {};
} // namespace coro::stdx
namespace coro {
class Task {
public:
  void await_ready();
  void await_suspend(stdx::coroutine_handle<>);
  void await_resume();
  struct promise_type {
    struct final_awaitable {
      void await_ready();
      template <typename V> void await_suspend(V);
      void await_resume();
    };
    std::suspend_never initial_suspend();
    final_awaitable final_suspend();
    void unhandled_exception();
  };
};
} // namespace coro
namespace std {
class optional {
public:
  template <typename _Up> optional(_Up);
};
} // namespace std
namespace coro::http {
struct Request {
  std::optional body;
};
template <typename> concept HttpClient = requires { stdx::stop_token(); };
} // namespace coro::http
namespace coro::cloudstorage {
template <typename T> concept CloudProviderImpl = requires(T stop_token) {
  stop_token;
};
template <CloudProviderImpl Impl> class CloudProvider : Impl {
public:
  Impl::Impl;
  template <http::HttpClient HttpClient>
  void RefreshAccessToken(HttpClient http, int refresh_token,
                          stdx::stop_token stop_token = stdx::stop_token()) {
    Impl::RefreshAccessToken(http, refresh_token, stop_token);
  }
};
} // namespace coro::cloudstorage
namespace coro::util {
template <typename RequestType>
Task FetchJson(auto, RequestType, stdx::stop_token);
}
namespace coro::http {
template <typename List = std::initializer_list<std::pair>>
int FormDataToString(List);
}
namespace coro::cloudstorage {
class GoogleDrive {
public:
  GoogleDrive(int);
  template <http::HttpClient HttpClient>
  Task RefreshAccessToken(HttpClient http, int refresh_token,
                          stdx::stop_token stop_token) {
    co_await util::FetchJson(
        http, http::Request{http::FormDataToString({{"", refresh_token}})},
        stop_token);
  }
};
} // namespace coro::cloudstorage
using coro::cloudstorage::CloudProvider;
using coro::cloudstorage::GoogleDrive;
int GetGoogleDriveAuthData();
template <coro::http::HttpClient HttpClient>
void GetAccessToken(int *, HttpClient http) {
  CloudProvider<GoogleDrive>(GetGoogleDriveAuthData())
      .RefreshAccessToken(http, std::string());
}
void CoMain() {
  int *event_loop;
  void http();
  GetAccessToken(event_loop, http);
}

$ g++ cloudstorage.cc.ii -c -fcoroutines -std=gnu++2a
cloudstorage.cc.ii:65:3: warning: access declarations are deprecated in favour
of using-declarations; suggestion: add the ‘using’ keyword [-Wdeprecated]
   65 |   Impl::Impl;
      |   ^~~~
cloudstorage.cc.ii: In instantiation of ‘coro::Task
coro::cloudstorage::GoogleDrive::RefreshAccessToken(HttpClient, int,
coro::stdx::stop_token) [with HttpClient = void (*)()]’:
cloudstorage.cc.ii:69:29:   required from ‘void
coro::cloudstorage::CloudProvider<Impl>::RefreshAccessToken(HttpClient, int,
coro::stdx::stop_token) [with HttpClient = void (*)(); Impl =
coro::cloudstorage::GoogleDrive]’
cloudstorage.cc.ii:100:26:   required from ‘void GetAccessToken(int*,
HttpClient) [with HttpClient = void (*)()]’
cloudstorage.cc.ii:105:34:   required from here
cloudstorage.cc.ii:91:3: 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:9862
   91 |   }
      |   ^
0x80d3ef tree_check_failed(tree_node const*, char const*, int, char const*,
...)
        /home/marxin/Programming/gcc/gcc/tree.c:9810
0x62a1ea tree_check3(tree_node*, char const*, int, char const*, tree_code,
tree_code, tree_code)
        /home/marxin/Programming/gcc/gcc/tree.h:3371
0x62a1ea build_special_member_call(tree_node*, tree_node*, vec<tree_node*,
va_gc, vl_embed>**, tree_node*, int, int)
        /home/marxin/Programming/gcc/gcc/cp/call.c:9862
0x92c1a4 flatten_await_stmt
        /home/marxin/Programming/gcc/gcc/cp/coroutines.cc:2871
0x92bd96 flatten_await_stmt
        /home/marxin/Programming/gcc/gcc/cp/coroutines.cc:2889
0x92bd96 flatten_await_stmt
        /home/marxin/Programming/gcc/gcc/cp/coroutines.cc:2889
0x92bd96 flatten_await_stmt
        /home/marxin/Programming/gcc/gcc/cp/coroutines.cc:2889
0x92bd96 flatten_await_stmt
        /home/marxin/Programming/gcc/gcc/cp/coroutines.cc:2889
0x92d5fb maybe_promote_temps
        /home/marxin/Programming/gcc/gcc/cp/coroutines.cc:3074
0x92d5fb await_statement_walker
        /home/marxin/Programming/gcc/gcc/cp/coroutines.cc:3579
0x132093a walk_tree_1(tree_node**, tree_node* (*)(tree_node**, int*, void*),
void*, hash_set<tree_node*, false, default_hash_traits<tree_node*> >*,
tree_node* (*)(tree_node**, int*, tree_node* (*)(tree_node**, int*, void*),
void*, hash_set<tree_node*, false, default_hash_traits<tree_node*> >*))
        /home/marxin/Programming/gcc/gcc/tree.c:12089
0x92d100 await_statement_walker
        /home/marxin/Programming/gcc/gcc/cp/coroutines.cc:3339
0x132093a walk_tree_1(tree_node**, tree_node* (*)(tree_node**, int*, void*),
void*, hash_set<tree_node*, false, default_hash_traits<tree_node*> >*,
tree_node* (*)(tree_node**, int*, tree_node* (*)(tree_node**, int*, void*),
void*, hash_set<tree_node*, false, default_hash_traits<tree_node*> >*))
        /home/marxin/Programming/gcc/gcc/tree.c:12089
0x1320ade walk_tree_1(tree_node**, tree_node* (*)(tree_node**, int*, void*),
void*, hash_set<tree_node*, false, default_hash_traits<tree_node*> >*,
tree_node* (*)(tree_node**, int*, tree_node* (*)(tree_node**, int*, void*),
void*, hash_set<tree_node*, false, default_hash_traits<tree_node*> >*))
        /home/marxin/Programming/gcc/gcc/tree.c:12425
0x92d100 await_statement_walker
        /home/marxin/Programming/gcc/gcc/cp/coroutines.cc:3339
0x132093a walk_tree_1(tree_node**, tree_node* (*)(tree_node**, int*, void*),
void*, hash_set<tree_node*, false, default_hash_traits<tree_node*> >*,
tree_node* (*)(tree_node**, int*, tree_node* (*)(tree_node**, int*, void*),
void*, hash_set<tree_node*, false, default_hash_traits<tree_node*> >*))
        /home/marxin/Programming/gcc/gcc/tree.c:12089
0x92d7de await_statement_walker
        /home/marxin/Programming/gcc/gcc/cp/coroutines.cc:3327
0x132093a walk_tree_1(tree_node**, tree_node* (*)(tree_node**, int*, void*),
void*, hash_set<tree_node*, false, default_hash_traits<tree_node*> >*,
tree_node* (*)(tree_node**, int*, tree_node* (*)(tree_node**, int*, void*),
void*, hash_set<tree_node*, false, default_hash_traits<tree_node*> >*))
        /home/marxin/Programming/gcc/gcc/tree.c:12089
0x928abc morph_fn_to_coro(tree_node*, tree_node**, tree_node**)
        /home/marxin/Programming/gcc/gcc/cp/coroutines.cc:4166
0x973e71 finish_function(bool)
        /home/marxin/Programming/gcc/gcc/cp/decl.c:16982
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

Reply via email to