================
@@ -111,3 +119,34 @@ namespace cwg1070 { // cwg1070: 3.5
C c = {};
#endif
} // namespace cwg1070
+
+#if __cplusplus >= 201103L
+namespace cwg1094 { // cwg1094: 24
+enum class E : bool { Zero, One };
----------------
joyeecheung wrote:
> CWG1094 is not limited to enums with the underlying type of bool, so I want
> to see a similar set of test cases, but with enum whose fixed underlying type
> is int.
We do have the similar set with `enum class G : unsigned char` below (since the
negatives still mirror out-of-range coverage that way) - do you want it to be
switched to int or be complemented with int-backed enums? Or is unsigned char
good enough?
> I'm not sure I agree with the description of CWG1094...is handling enums
> without a fixed underlying type, as this paragraph was removed recently in
> [CWG2987](https://cplusplus.github.io/CWG/issues/2987.html) "Remove
> dilapidated wording from static_cast".
>From my reading, yes the motivation of CWG1094 was to address the
>underspecification about float -> enum conversions, which until the
>resolution, hinged on inversing `conv.fpint` but the inverse only applied to
>unscoped enums and therefore missed out on scoped enums. While that was the
>motivation, the resolution ended up covering all enums since it didn't qualify
>"enumeration type":
> A value of floating-point type can also be converted to an enumeration type.
> The resulting value is the same as converting the original value to the
> underlying type of the enumeration (7.3.11
> [[conv.fpint](https://wg21.link/conv.fpint)]), and subsequently to the
> enumeration type.
With this and other clarifications, nothing hinged on the inverse rule any
more, and so CWG2987 removed the inverse rule.
> Separately, since we're looking closely at this wording, I think we should
> mark [CWG1739](https://cplusplus.github.io/CWG/issues/1739.html) "Conversion
> of floating point to enumeration" as N/A.
Agreed and fixed in PR - let me know if you prefer it to be done in a separate
PR, thanks!
https://github.com/llvm/llvm-project/pull/211172
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits