8sa1-gcc/libstdc++-v3/include
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
..
backward
bits libstdc++: Add nodiscard attribute to cast-like functions 2021-04-06 16:43:25 +01:00
c
c_compatibility
c_global libstdc++: Add nodiscard attribute to cast-like functions 2021-04-06 16:43:25 +01:00
c_std
debug libstdc++: _GLIBCXX_DEBUG Fix allocator-extended move constructor 2021-03-28 22:06:33 +02:00
decimal libstdc++: Fix doxygen markup for group close commands 2021-04-06 16:43:24 +01:00
experimental libstdc++: Fix doxygen markup for group close commands 2021-04-06 16:43:24 +01:00
ext libstdc++: Fix Doxygen warnings 2021-04-06 16:43:24 +01:00
parallel
precompiled
pstl libstdc++: Fix up parallel_backend_serial.h [PR97549] 2021-02-23 09:28:14 +01:00
std libstdc++: Make std::is_scoped_enum work with incomplete types 2021-04-08 11:56:59 +01:00
tr1 libstdc++: Fix doxygen markup for group close commands 2021-04-06 16:43:24 +01:00
tr2 libstdc++: Fix doxygen markup for group close commands 2021-04-06 16:43:24 +01:00
Makefile.am
Makefile.in