https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66284
Bug ID: 66284 Summary: std::reference_wrapper is transparent to std::function::target_type Product: gcc Version: 5.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: potswa at mac dot com Target Milestone: --- std::function elides reference_wrappers from the target. This is not conforming. #include <functional> #include <cassert> struct s { void operator () () {} } g; std::function< void() > f = std::ref( g ); int main() { assert ( f.target< std::reference_wrapper< s > >() ); assert ( ! f.target< s >() ); }