https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92536
Bug ID: 92536 Summary: [10 Regression] ICE when trying to using deduction guide following unknown type error Product: gcc Version: 10.0 Status: UNCONFIRMED Keywords: error-recovery, ice-on-invalid-code Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: redi at gcc dot gnu.org Target Milestone: --- namespace std { struct stop_token { }; template<typename Callback> struct stop_callback { template<typename C> stop_callback(stop_token, C&&) { } }; template<typename _Callback> stop_callback(stop_token, _Callback) -> stop_callback<_Callback>; } int main() { std::stop_token tok; std::function<void()> f([](){}); std::stop_callback cb(tok, f); } This crashes when compiled with -std=gnu++17 stop.cc: In function 'int main()': stop.cc:19:8: error: 'function' is not a member of 'std' 19 | std::function<void()> f([](){}); | ^~~~~~~~ stop.cc:1:1: note: 'std::function' is defined in header '<functional>'; did you forget to '#include <functional>'? +++ |+#include <functional> 1 | namespace std stop.cc:19:25: error: 'f' was not declared in this scope 19 | std::function<void()> f([](){}); | ^ stop.cc:20:31: error: class template argument deduction failed: 20 | std::stop_callback cb(tok, f); | ^ stop.cc:20:31: internal compiler error: Segmentation fault 0xf80c3f crash_signal /home/jwakely/src/gcc/gcc/gcc/toplev.c:328 0x85a1b5 add_candidates /home/jwakely/src/gcc/gcc/gcc/cp/call.c:5772 0x85efbb add_candidates /home/jwakely/src/gcc/gcc/gcc/cp/call.c:4453 0x85efbb perform_overload_resolution /home/jwakely/src/gcc/gcc/gcc/cp/call.c:4461 0x8656a2 build_new_function_call(tree_node*, vec<tree_node*, va_gc, vl_embed>**, int) /home/jwakely/src/gcc/gcc/gcc/cp/call.c:4535 0x9c207f do_class_deduction /home/jwakely/src/gcc/gcc/gcc/cp/pt.c:28071 0x9c207f do_auto_deduction(tree_node*, tree_node*, tree_node*, int, auto_deduction_context, tree_node*, int) /home/jwakely/src/gcc/gcc/gcc/cp/pt.c:28119 0x8eb86f cp_finish_decl(tree_node*, tree_node*, bool, tree_node*, int) /home/jwakely/src/gcc/gcc/gcc/cp/decl.c:7383 0x996e7e cp_parser_init_declarator /home/jwakely/src/gcc/gcc/gcc/cp/parser.c:20727 0x976d22 cp_parser_simple_declaration /home/jwakely/src/gcc/gcc/gcc/cp/parser.c:13624 0x978ae9 cp_parser_declaration_statement /home/jwakely/src/gcc/gcc/gcc/cp/parser.c:13055 0x979733 cp_parser_statement /home/jwakely/src/gcc/gcc/gcc/cp/parser.c:11380 0x97a6b8 cp_parser_statement_seq_opt /home/jwakely/src/gcc/gcc/gcc/cp/parser.c:11742 0x97a797 cp_parser_compound_statement /home/jwakely/src/gcc/gcc/gcc/cp/parser.c:11696 0x993110 cp_parser_function_body /home/jwakely/src/gcc/gcc/gcc/cp/parser.c:22866 0x993110 cp_parser_ctor_initializer_opt_and_function_body /home/jwakely/src/gcc/gcc/gcc/cp/parser.c:22917 0x996466 cp_parser_function_definition_after_declarator /home/jwakely/src/gcc/gcc/gcc/cp/parser.c:28586 0x997273 cp_parser_function_definition_from_specifiers_and_declarator /home/jwakely/src/gcc/gcc/gcc/cp/parser.c:28502 0x997273 cp_parser_init_declarator /home/jwakely/src/gcc/gcc/gcc/cp/parser.c:20495 0x976d22 cp_parser_simple_declaration /home/jwakely/src/gcc/gcc/gcc/cp/parser.c:13624 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.