Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enums types with fixed underlying type should compare equal to underlying type #683

Closed
ehaas opened this issue Apr 15, 2024 · 0 comments
Closed
Labels
bug Something isn't working

Comments

@ehaas
Copy link
Collaborator

ehaas commented Apr 15, 2024

The following code should not produce any error diagnostics:

enum E {
    A,
};

enum E_signed: int {
    B,
};

enum E_unsigned: unsigned {
    C,
};

_Static_assert(!__builtin_types_compatible_p(enum E, enum E_signed), "");
_Static_assert(!__builtin_types_compatible_p(enum E, enum E_unsigned), "");

_Static_assert(__builtin_types_compatible_p(int, enum E_signed), "");
_Static_assert(!__builtin_types_compatible_p(unsigned, enum E_signed), "");

_Static_assert(!__builtin_types_compatible_p(int, enum E_unsigned), "");
_Static_assert(__builtin_types_compatible_p(unsigned, enum E_unsigned), "");
@ehaas ehaas added the bug Something isn't working label Apr 15, 2024
ehaas added a commit to ehaas/arocc that referenced this issue Apr 16, 2024
Enums types with fixed underlying type should compare equal to the
underlying type, but not to other enums with the same fixed underlying
type.

Closes Vexu#683
@Vexu Vexu closed this as completed in fd94d6f Apr 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant