[libcxx-commits] [PATCH] D63574: Implement P0340R3: Make `underlying_type` SFINAE-friendly

Richard Smith - zygoloid via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu Jun 20 10:23:42 PDT 2019


rsmith added a comment.

In D63574#1551933 <https://reviews.llvm.org/D63574#1551933>, @mclow.lists wrote:

> In D63574#1551251 <https://reviews.llvm.org/D63574#1551251>, @mclow.lists wrote:
>
> > How many of these should fail?
>
>
> Turns out that only the first one should fail - and that's the one that clang rejects.


That's right. A couple more testcases to exercise the corners here:

  enum E7 : std::underlying_type_t<E7> {};
  enum class E8 : std::underlying_type_t<E8> {};

(Clang gets the point of declaration for enums wrong at the moment and thinks that `E7` and `E8` are not in scope in the //enum-base//. But those two should be rejected either way.)



================
Comment at: libcxx/test/std/utilities/meta/meta.trans/meta.trans.other/underlying_type.fail.cpp:19
+
+enum E1 { zero, one, two = sizeof(std::underlying_type<E1>::type) };
+
----------------
mclow.lists wrote:
> I can add an `expected-error {{cannot determine underlying type of incomplete enumeration type 'E1'}}` here if people want.
> 
Given that conformance requires a diagnostic here ("Mandates:"), that'd seem like a good thing to test to me.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D63574/new/

https://reviews.llvm.org/D63574





More information about the libcxx-commits mailing list