[PATCH] Do not copy std:call_once arguments (LWG 2442)

Jonathan Wakely jwakely@redhat.com
Wed Oct 12 12:16:00 GMT 2016

On 12/10/16 12:22 +0100, Jonathan Wakely wrote:
>This replaces the use of std::__bind_simple by direct calls to
>std::__invoke so that the arguments are not decay-copied.
>	* doc/xml/manual/intro.xml: Document LWG 2442 status.
>	* include/std/mutex [_GLIBCXX_HAVE_TLS] (__once_call_impl): Remove.
>	[_GLIBCXX_HAVE_TLS] (_Once_call): Declare primary template and define
>	partial specialization to unpack args and forward to std::invoke.
>	(call_once) [_GLIBCXX_HAVE_TLS]: Use forward_as_tuple and _Once_call
>	instead of __bind_simple and __once_call_impl.
>	(call_once) [!_GLIBCXX_HAVE_TLS]: Use __invoke instead of
>	__bind_simple.
>	* testsuite/30_threads/call_once/dr2442.cc: New test.
>Tested powerpc64le-linux, committed to trunk.

I don't know why I over-complicated it by packing and unpacking the
args in a tuple, this is much simpler, and makes the TLS and non-TLS
implementations more similar.

Tested powerpc64le-linux, committed to trunk.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.txt
Type: text/x-patch
Size: 2101 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20161012/ed350e21/attachment.bin>

More information about the Gcc-patches mailing list