gcc/libstdc++-v3/testsuite
Jonathan Wakely 43ab1dc24a libstdc++: Make std::is_scoped_enum work with incomplete types
Tim Song pointed out that using __underlying_type is ill-formed for
incomplete enumeration types, and is_scoped_enum doesn't require a
complete type. This changes the trait to check for conversion to int
instead of to the underlying type.

In order to give the correct result when the trait is used in the
enumerator-list of an incomplete type the partial specialization for
enums has an additional check that fails for incomplete types. This
assumes that an incompelte enumeration type must be an unscoped
enumeration, and so the primary template (with a std::false_type base
characteristic) can be used. This isn't necessarily true, but it is not
currently possible to refer to a scoped enumeration type before its type
is complete (PR c++/89025).

It should be possible to use requires(remove_cv_t<_Tp> __t) in the
partial specialization's assignablility check, but that currently gives
an ICE (PR c++/99968) so there is an extra partial specialization of
is_scoped_enum<const _Tp> to handle const types.

libstdc++-v3/ChangeLog:

	* include/std/type_traits (is_scoped_enum<T>): Constrain partial
	specialization to not match incomplete enum types. Use a
	requires-expression instead of instantiating is_convertible.
	(is_scoped_enum<const T>): Add as workaround for PR c++/99968.
	* testsuite/20_util/is_scoped_enum/value.cc: Check with
	incomplete types and opaque-enum-declarations.
2021-04-08 11:56:59 +01:00
..
17_intro libstdc++, testsuite, Darwin : Adjust for names used in system headers. 2021-03-15 15:42:39 +00:00
18_support c++: Fix source_location inconsistency between calls from templates and non-templates [PR99672] 2021-03-25 21:35:11 +01:00
19_diagnostics libstdc++: Fix incorrect test for std::error_code comparisons 2021-02-03 15:49:36 +00:00
20_util libstdc++: Make std::is_scoped_enum work with incomplete types 2021-04-08 11:56:59 +01:00
21_strings libstdc++: Fix and complete __gnu_debug::basic_string implementation 2021-03-25 21:56:14 +01:00
22_locale Update copyright years. 2021-01-04 10:26:59 +01:00
23_containers libstdc++: _GLIBCXX_DEBUG Fix allocator-extended move constructor 2021-03-28 22:06:33 +02:00
24_iterators libstdc++: Add noexcept to std::begin etc as per LWG 2280 and 3537 2021-03-22 15:56:49 +00:00
25_algorithms Update copyright years. 2021-01-04 10:26:59 +01:00
26_numerics libstdc++: Add PRNG fallback to std::random_device 2021-03-26 19:12:12 +00:00
27_io libstdc++: Fix filesystem::path construction from COW string [PR 99805] 2021-04-07 16:39:24 +01:00
28_regex Update copyright years. 2021-01-04 10:26:59 +01:00
29_atomics Add options to link with libatomic in various tests. 2021-03-10 16:01:12 +00:00
30_threads improve future::poll calibration loop 2021-03-31 15:45:56 -03:00
abi Update copyright years. 2021-01-04 10:26:59 +01:00
backward Update copyright years. 2021-01-04 10:26:59 +01:00
config Update copyright years. 2021-01-04 10:26:59 +01:00
data
decimal Update copyright years. 2021-01-04 10:26:59 +01:00
experimental libstdc++: Fix filesystem::rename on Windows [PR 98985] 2021-02-12 15:29:50 +00:00
ext libstdc++: Suppress more vstring testsuite warnings. [PR 98613] 2021-01-10 18:22:51 -05:00
lib Update copyright years. 2021-01-04 10:26:59 +01:00
libstdc++-abi Update copyright years. 2021-01-04 10:26:59 +01:00
libstdc++-dg libstdc++: Add std::experimental::simd from the Parallelism TS 2 2021-01-27 16:37:26 +00:00
libstdc++-prettyprinters Update copyright years. 2021-01-04 10:26:59 +01:00
libstdc++-xmethods Update copyright years. 2021-01-04 10:26:59 +01:00
performance Update copyright years. 2021-01-04 10:26:59 +01:00
special_functions Update copyright years. 2021-01-04 10:26:59 +01:00
std libstdc++: Improve test for views::reverse 2021-03-23 18:24:39 +00:00
tr1 Update copyright years. 2021-01-04 10:26:59 +01:00
tr2 Update copyright years. 2021-01-04 10:26:59 +01:00
util libstdc++: Add PRNG fallback to std::random_device 2021-03-26 19:12:12 +00:00
Makefile.am libstdc++: Work around test failures using -mno-tree-vrp 2021-02-03 15:49:30 +00:00
Makefile.in libstdc++: Work around test failures using -mno-tree-vrp 2021-02-03 15:49:30 +00:00