[PATCH 2/3] Fix std::visit to support arbitrary callables

Jonathan Wakely jwakely@redhat.com
Tue Apr 9 18:53:00 GMT 2019


The __visitor_result_type helper didn't use std::invoke and so didn't
compile when the visitor was a pointer-to-member rather than a function
object. Use std::invoke_result instead.
    
	* include/std/variant (__variant_idx_cookie): Add member type.
	(__visitor_result_type): Remove.
	(__do_visit): Use invoke_result instead of __visitor_result_type.
	* testsuite/20_util/variant/visit.cc: New test.

Tested powerpc64le-linux, committed to trunk.


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


More information about the Gcc-patches mailing list