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] PR 70564 disambiguate constructors for not_fn call wrapper


The _Not_fn::_Not_fn<_Fn2>(_Fn2&&) ctor gets chosen by overload
resolution when trying to copy the call wrapper object (although only
for direct-initialization, because it's explicit). Rather than
constraining it using SFINAE I'm just adding a second parameter, so it
isn't viable for copying or moving the call wrapper.

I'm also reusing std::_Not_fn for std::experimental::not_fn, so we
don't need to fix bugs like this twice. _Not_fn uses std::invoke and
std::is_nothrow_callable, but we have __nonstandard versions of both
available in C++14.

	PR libstdc++/70564
	* include/experimental/functional (_Not_fn): Remove.
	(not_fn): Use std::_Not_fn.
	* include/std/functional (_Not_fn): Add second parameter to
	disambiguate copying from initialization by not_fn. Define for C++14.
	(not_fn): Add second argument to initialization.
	* testsuite/20_util/not_fn/1.cc: Copy call wrapper using
	direct-initialization.

Tested powerpc64le-linux, committing to trunk and gcc-6-branch.

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]