https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83817
Bug ID: 83817 Summary: [8 Regression] Product: gcc Version: 8.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: olegendo at gcc dot gnu.org Target Milestone: --- Target: rx*-*-* Build: internal compiler error: tree check: expected call_expr, have aggr_init_expr in tsubst_copy_and_build, at cp/pt.c:17822 Compiling the following on RX with -O2 -std=c++14 #include <string> struct message { std::string m_content_data; }; struct response : message { }; struct request : message { }; typedef response (*http_handler_func)(const request&); struct http_handler { const char* uri; http_handler_func func; }; static response some_handler (const request&); static const http_handler http_handlers_single[] = { { "x", [] (const auto& r) { return some_handler (r); } }, }; results in http_server_bug.cpp: In instantiation of 'static decltype (((const<lambda(const auto:1&)>*)((const<lambda(const auto:1&)>* const)0))->operator()(static_cast<const auto:1&>(<anonymous>)))<lambda(const auto:1&)>::_FUN(const auto:1&) [with auto:1 = request; decltype (((const<lambda(const auto:1&)>*)((const<lambda(const auto:1&)>* const)0))->operator()(static_cast<const auto:1&>(<anonymous>))) = response]': http_server_bug.cpp:25:56: required from '<lambda(const auto:1&)>::operator decltype (((const<lambda(const auto:1&)>*)((const<lambda(const auto:1&)>* const)0))->operator()(static_cast<const auto:1&>(<anonymous>))) (*)(const auto:1&)() const [with auto:1 = request; decltype (((const<lambda(const auto:1&)>*)((const<lambda(const auto:1&)>* const)0))->operator()(static_cast<const auto:1&>(<anonymous>))) = response]' http_server_bug.cpp:26:1: required from here http_server_bug.cpp:25:56: internal compiler error: tree check: expected call_expr, have aggr_init_expr in tsubst_copy_and_build, at cp/pt.c:17822 { "x", [] (const auto& r) { return some_handler (r); } }, ^ 0x58ae34 tree_check_failed(tree_node const*, char const*, int, char const*, ...) ../../gcc-trunk/gcc/tree.c:9375 0x75721a tree_check(tree_node*, char const*, int, char const*, tree_code) ../../gcc-trunk/gcc/tree.h:3127 0x75721a tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool, bool) ../../gcc-trunk/gcc/cp/pt.c:17822 0x75a163 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool) ../../gcc-trunk/gcc/cp/pt.c:16765 0x75944c tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool) ../../gcc-trunk/gcc/cp/pt.c:15996 0x759693 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool) ../../gcc-trunk/gcc/cp/pt.c:16249 0x795aee instantiate_decl(tree_node*, bool, bool) ../../gcc-trunk/gcc/cp/pt.c:23311 0x79d1e9 instantiate_pending_templates(int) ../../gcc-trunk/gcc/cp/pt.c:23427 0x67dd02 c_parse_final_cleanups() ../../gcc-trunk/gcc/cp/decl2.c:4705