gcc/libstdc++-v3/testsuite
Jonathan Wakely aaeac1568d P0357R3 reference_wrapper for incomplete types
This patch implements the C++2a proposal to allow incomplete types in
std::reference_wrapper, which was previously undefined.

The change cannot be implemented for earlier standards, because prior to
C++2a std::reference_wrapper has a weak result type, so must inspect the
template argument to see if it defines a nested result_type member. That
is deprecated (but still required) in C++17, and removed from C++2a.

The removal of the base class from reference_wrapper is a potential ABI
change, as it could alter the layout of a type which derives from
reference_wrapper<T> and from an empty type with _Weak_result_type<T> as
a base class.  Previously the repeated _Weak_result_type<T> base class
would have prevented the empty base-class optimization, but if
reference_wrapper<T> no longer derives from it, the empty class could be
placed at the same address as the reference_wrapper<T> base.  In
practice, the only types which derive from _Weak_result_type or from
_Reference_wrapper_base_memfun or any of its base classes are non-empty
types defined in libstdc++: std::reference_wrapper, std::function, and
std::_Bind. As they are non-empty types, they are not eligible for EBO
anyway.

	* include/bits/refwrap.h [__cplusplus > 201703L]
	(_Refwrap_base_arg1, _Refwrap_base_arg2, _Reference_wrapper_base)
	(_Reference_wrapper_base_memfun): Do not define for C++2a.
	(reference_wrapper): Do not derive from _Reference_wrapper_base_memfun
	for C++2a.
	(reference_wrapper::operator()): Add static assertion.
	* testsuite/20_util/reference_wrapper/incomplete.cc: New test.

From-SVN: r267866
2019-01-11 23:41:11 +00:00
..
17_intro PR libstdc++/88607 add tests using -finput-charset=ascii 2019-01-06 00:49:11 +00:00
18_support Update copyright years. 2019-01-01 13:31:55 +01:00
19_diagnostics Update copyright years. 2019-01-01 13:31:55 +01:00
20_util P0357R3 reference_wrapper for incomplete types 2019-01-11 23:41:11 +00:00
21_strings Add allocator-extended copy/move ctors to COW string 2019-01-04 23:23:17 +00:00
22_locale PR libstdc++/88681 export missing symbols 2019-01-03 20:38:04 +00:00
23_containers Define __cpp_lib_erase_if feature test macro 2019-01-10 13:49:31 +00:00
24_iterators Update copyright years. 2019-01-01 13:31:55 +01:00
25_algorithms Update copyright years. 2019-01-01 13:31:55 +01:00
26_numerics PR libstdc++/88204 disable std::complex<long double> tests 2019-01-09 09:37:34 +00:00
27_io Fix filesystem::last_write_time failure with 32-bit time_t 2019-01-10 15:39:28 +00:00
28_regex Update copyright years. 2019-01-01 13:31:55 +01:00
29_atomics Update copyright years. 2019-01-01 13:31:55 +01:00
30_threads Update copyright years. 2019-01-01 13:31:55 +01:00
abi Update copyright years. 2019-01-01 13:31:55 +01:00
backward Update copyright years. 2019-01-01 13:31:55 +01:00
config Update copyright years. 2019-01-01 13:31:55 +01:00
data
decimal Update copyright years. 2019-01-01 13:31:55 +01:00
experimental Check AI_NUMERICSERV is defined before using it 2019-01-10 13:21:54 +00:00
ext Update copyright years. 2019-01-01 13:31:55 +01:00
lib Update copyright years. 2019-01-01 13:31:55 +01:00
libstdc++-abi Update copyright years. 2019-01-01 13:31:55 +01:00
libstdc++-dg Update copyright years. 2019-01-01 13:31:55 +01:00
libstdc++-prettyprinters Fix failing prettyprinter test 2019-01-09 10:46:52 +00:00
libstdc++-xmethods Update copyright years. 2019-01-01 13:31:55 +01:00
performance Update copyright years. 2019-01-01 13:31:55 +01:00
special_functions Update copyright years. 2019-01-01 13:31:55 +01:00
tr1 Update copyright years. 2019-01-01 13:31:55 +01:00
tr2 Update copyright years. 2019-01-01 13:31:55 +01:00
util Include name of test in filesystem-test.XXXXXX filenames 2019-01-10 11:12:00 +00:00
Makefile.am Update copyright years. 2019-01-01 13:31:55 +01:00
Makefile.in Update GCC to autoconf 2.69, automake 1.15.1 (PR bootstrap/82856). 2018-10-31 17:03:16 +00:00