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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2015-04-15
           Assignee|unassigned at gcc dot gnu.org      |redi at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
The problem is that 'C c = C();' has to check for an accessible copy
constructor, which needs to perform overload resolution on the constructors of
C.

That means checking if the std::function<C(...)> arguments can be initialized
from an rvalue of type C. std::function has SFINAE constraints to check if it
is being constructed from a suitable type, and those constrraints require a
complete type.

This fixes it by short-circuiting the constraints, but this might have unwanted
consequences:

--- include/c++/5.0.0/functional.orig   2015-04-15 12:54:33.198940049 +0100
+++ include/c++/5.0.0/functional        2015-04-15 12:54:35.671952823 +0100
@@ -1962,7 +1962,7 @@

   template<typename _From, typename _To>
     using __check_func_return_type
-      = __or_<is_void<_To>, is_convertible<_From, _To>>;
+      = __or_<is_void<_To>, is_same<_From, _To>, is_convertible<_From, _To>>;

   /**
    *  @brief Primary class template for std::function.

Reply via email to