https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79486
Jonathan Wakely <redi at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |rejects-valid Status|UNCONFIRMED |ASSIGNED Last reconfirmed| |2017-02-13 Known to work| |6.3.1 Target Milestone|--- |7.0 Summary|[7 Regression] |[7 Regression] | |packaged_task uses wrong | |value category with | |result_of Ever confirmed|0 |1 --- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> --- #include <future> struct F { int& operator()() & { return i; } void operator()() && = delete; int i = 0; }; int main() { std::packaged_task<int()> t{F{}}; t(); } This fails to compie, and also gives an ICE (which I'll report separately) In file included from task.cc:1:0: /home/jwakely/gcc/7/include/c++/7.0.1/future: In instantiation of ‘struct std::__future_base::_Task_state<_Fn, _Alloc, _Res(_Args ...)>::_M_run(_Args&& ...) [with _Fn = F; _Alloc = std::allocator<int>; _Res = int; _Args = {}]::<lambda>’: /home/jwakely/gcc/7/include/c++/7.0.1/future:1419:7: required from ‘void std::__future_base::_Task_state<_Fn, _Alloc, _Res(_Args ...)>::_M_run(_Args&& ...) [with _Fn = F; _Alloc = std::allocator<int>; _Res = int; _Args = {}]’ task.cc:13:1: required from here /home/jwakely/gcc/7/include/c++/7.0.1/future:1419:66: error: no type named ‘type’ in ‘class std::result_of<F()>’ auto __boundfn = [&] () -> typename result_of<_Fn(_Args&&...)>::type { ^~~~ /home/jwakely/gcc/7/include/c++/7.0.1/future: In instantiation of ‘struct std::__future_base::_Task_state<_Fn, _Alloc, _Res(_Args ...)>::_M_run_delayed(_Args&& ..., std::weak_ptr<std::__future_base::_State_baseV2>) [with _Fn = F; _Alloc = std::allocator<int>; _Res = int; _Args = {}]::<lambda>’: /home/jwakely/gcc/7/include/c++/7.0.1/future:1428:7: required from ‘void std::__future_base::_Task_state<_Fn, _Alloc, _Res(_Args ...)>::_M_run_delayed(_Args&& ..., std::weak_ptr<std::__future_base::_State_baseV2>) [with _Fn = F; _Alloc = std::allocator<int>; _Res = int; _Args = {}]’ task.cc:13:1: required from here /home/jwakely/gcc/7/include/c++/7.0.1/future:1428:66: error: no type named ‘type’ in ‘class std::result_of<F()>’ auto __boundfn = [&] () -> typename result_of<_Fn(_Args&&...)>::type { ^~~~ /home/jwakely/gcc/7/include/c++/7.0.1/future:600:7: error: ‘static std::__future_base::_Task_setter<_Res_ptr, _BoundFn> std::__future_base::_S_task_setter(_Res_ptr&, _BoundFn&) [with _Res_ptr = std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>; _BoundFn = std::__future_base::_Task_state<_Fn, _Alloc, _Res(_Args ...)>::_M_run(_Args&& ...) [with _Fn = F; _Alloc = std::allocator<int>; _Res = int; _Args = {}]::<lambda>; typename _Res_ptr::element_type::result_type = int]’, declared using local type ‘std::__future_base::_Task_state<_Fn, _Alloc, _Res(_Args ...)>::_M_run(_Args&& ...) [with _Fn = F; _Alloc = std::allocator<int>; _Res = int; _Args = {}]::<lambda>’, is used but never defined [-fpermissive] _S_task_setter(_Res_ptr& __ptr, _BoundFn& __call) ^~~~~~~~~~~~~~ /home/jwakely/gcc/7/include/c++/7.0.1/future:600:7: error: ‘static std::__future_base::_Task_setter<_Res_ptr, _BoundFn> std::__future_base::_S_task_setter(_Res_ptr&, _BoundFn&) [with _Res_ptr = std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>; _BoundFn = std::__future_base::_Task_state<_Fn, _Alloc, _Res(_Args ...)>::_M_run_delayed(_Args&& ..., std::weak_ptr<std::__future_base::_State_baseV2>) [with _Fn = F; _Alloc = std::allocator<int>; _Res = int; _Args = {}]::<lambda>; typename _Res_ptr::element_type::result_type = int]’, declared using local type ‘std::__future_base::_Task_state<_Fn, _Alloc, _Res(_Args ...)>::_M_run_delayed(_Args&& ..., std::weak_ptr<std::__future_base::_State_baseV2>) [with _Fn = F; _Alloc = std::allocator<int>; _Res = int; _Args = {}]::<lambda>’, is used but never defined [-fpermissive] /home/jwakely/gcc/7/include/c++/7.0.1/future: In instantiation of ‘static std::__future_base::_Task_setter<_Res_ptr, _BoundFn> std::__future_base::_S_task_setter(_Res_ptr&, _BoundFn&) [with _Res_ptr = std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>; _BoundFn = std::__future_base::_Task_state<_Fn, _Alloc, _Res(_Args ...)>::_M_run_delayed(_Args&& ..., std::weak_ptr<std::__future_base::_State_baseV2>) [with _Fn = F; _Alloc = std::allocator<int>; _Res = int; _Args = {}]::<lambda>]’: /home/jwakely/gcc/7/include/c++/7.0.1/future:1426:7: required from here /home/jwakely/gcc/7/include/c++/7.0.1/future:600:7: internal compiler error: Segmentation fault 0xdc0ddf crash_signal /home/jwakely/src/gcc/gcc/gcc/toplev.c:333 0x84c9b6 contains_struct_check(tree_node*, tree_node_structure_enum, char const*, int, char const*) /home/jwakely/src/gcc/gcc/gcc/tree.h:3173 0x84c9b6 write_closure_type_name /home/jwakely/src/gcc/gcc/gcc/cp/mangle.c:1639 0x84c9b6 write_unqualified_name /home/jwakely/src/gcc/gcc/gcc/cp/mangle.c:1383 0x852717 write_name /home/jwakely/src/gcc/gcc/gcc/cp/mangle.c:937 0x8525bc write_local_name /home/jwakely/src/gcc/gcc/gcc/cp/mangle.c:2035 0x8525bc write_name /home/jwakely/src/gcc/gcc/gcc/cp/mangle.c:964 0x853209 write_class_enum_type /home/jwakely/src/gcc/gcc/gcc/cp/mangle.c:2777 0x853209 write_type /home/jwakely/src/gcc/gcc/gcc/cp/mangle.c:2195 0x8520e8 write_template_args /home/jwakely/src/gcc/gcc/gcc/cp/mangle.c:2806 0x85880d write_nested_name /home/jwakely/src/gcc/gcc/gcc/cp/mangle.c:1063 0x852457 write_name /home/jwakely/src/gcc/gcc/gcc/cp/mangle.c:976 0x8570d6 write_encoding /home/jwakely/src/gcc/gcc/gcc/cp/mangle.c:825 0x85915c mangle_decl_string /home/jwakely/src/gcc/gcc/gcc/cp/mangle.c:3757 0x8593ab get_mangled_id /home/jwakely/src/gcc/gcc/gcc/cp/mangle.c:3779 0x8593ab mangle_decl(tree_node*) /home/jwakely/src/gcc/gcc/gcc/cp/mangle.c:3849 0x1067f40 decl_assembler_name(tree_node*) /home/jwakely/src/gcc/gcc/gcc/tree.c:671 0x9aee1c symbol_table::insert_to_assembler_name_hash(symtab_node*, bool) /home/jwakely/src/gcc/gcc/gcc/symtab.c:171 0x9b4e3f cgraph_node::create(tree_node*) /home/jwakely/src/gcc/gcc/gcc/cgraph.c:511 0x9b4c90 cgraph_node::get_create(tree_node*) /home/jwakely/src/gcc/gcc/gcc/cgraph.c:533 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <http://gcc.gnu.org/bugs.html> for instructions.