[PATCH] D52339: Support enums with a fixed underlying type in all language modes
John McCall via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Sep 21 11:06:30 PDT 2018
rjmccall added a comment.
In https://reviews.llvm.org/D52339#1242241, @aaron.ballman wrote:
> In https://reviews.llvm.org/D52339#1242202, @erik.pilkington wrote:
>
> > From the last line in the paper, it seems that C++ compatibility is a goal of the paper (or at least a consideration). We should probably think about this if/when the final wording gets accepted though.
>
>
> Agreed. WG14's charter explicitly prefers compatibility with C++ when possible.
>
> The part that I wasn't quite sure on were the type constraints in the proposal. C++ allows any integral type and ignores cv qualifiers, but the proposal lists specific types and doesn't discuss qualifiers. By my reading, this is code allowed in C++ but prohibited in the proposed wording:
>
> enum E : const int32_t {
> One
> };
>
>
> (Because the type is int32_t and is cv-qualified.) However, it's possible that's an oversight rather than an intentional design. I'll bring it up with Clive to see, but perhaps we can spot other divergences and can provide him with a list of concerns on the implementation side.
Not accepting `typedef`s would be negligence on behalf of the committee, since generally people use this feature specifically to control the size of the `enum`, which you can't do portably without a `typedef`. Not accepting qualified types is a justifiable decision.
There's no reason to make this an `ObjC2`-only feature; we should probably eliminate that distinction throughout the compiler.
Repository:
rC Clang
https://reviews.llvm.org/D52339
More information about the cfe-commits
mailing list