On Sat, Mar 20, 2021 at 3:58 AM Jonathan Wakely <jwakely....@gmail.com> wrote:
>
>
>
> On Sat, 20 Mar 2021, 01:13 Tim Song via Libstdc++, <libstd...@gcc.gnu.org> 
> wrote:
>>
>> On Fri, Mar 19, 2021 at 3:13 PM Jonathan Wakely via Libstdc++
>> <libstd...@gcc.gnu.org> wrote:
>> >
>> > Implement this C++23 feature, as proposed by P1048R1.
>> >
>> > This implementation assumes that a C++23 compiler supports concepts
>> > already. I don't see any point in using preprocessor hacks to detect
>> > compilers which define __cplusplus to a post-C++20 value but don't
>> > support concepts yet.
>> >
>> > libstdc++-v3/ChangeLog:
>> >
>> >         * include/std/type_traits (is_scoped_enum): Define.
>> >         * include/std/version (__cpp_lib_is_scoped_enum): Define.
>> >         * testsuite/20_util/is_scoped_enum/value.cc: New test.
>> >         * testsuite/20_util/is_scoped_enum/version.cc: New test.
>> >
>> > Tested powerpc64le-linux. Committed to trunk.
>> >
>>
>> Using __underlying_type breaks for incomplete enumeration types. GCC
>> doesn't have incomplete scoped enums due to
>> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89025 but unscoped ones
>> exist:
>>
>> enum E {
>>     x = std::is_scoped_enum_v<E>
>> };
>
>
> Thanks, I'll just use int then. Maybe not until Monday though.
>
>

Using int avoids the hard error, but it appears to give the wrong
answer (presumably because the is_convertible check fails due to E
being incomplete). This may need to be handled explicitly?

Reply via email to