This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch] libstdc++/60594 - std::function<incomplete()>


The bug in the PR is that is_copy_constructible<std::function<bar()>>
performs overload resolution for function(const function&), which
instantiates the SFINAE constraints on the function(F) constructor
template, which instantiates is_convertible<bar, bar>, which is
ill-formed when bar is incomplete.

When bar is later completed you can't call the function(F) constructor
with any function object returning bar, because the constraints have
already been instantiated and so continue to produce the same result.

The fix is to exclude the function type from the constraints checks,
so that only the copy constructor is considered, and the function(F)
constructor template can be used later when bar is complete.

The new test also checks for the same problem with assignment.

Tested x86_64-linux, committed to trunk.
I plan to fix this for 4.8.3 and 4.9.1 too.

Attachment: patch.txt
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]