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

Integral promotion is excluded by Integral conversion in [expr.static.cast#10] #4750

Closed
xmh0511 opened this issue Jul 15, 2021 · 0 comments · Fixed by #4758
Closed

Integral promotion is excluded by Integral conversion in [expr.static.cast#10] #4750

xmh0511 opened this issue Jul 15, 2021 · 0 comments · Fixed by #4758
Assignees

Comments

@xmh0511
Copy link
Contributor

xmh0511 commented Jul 15, 2021

A value of integral or enumeration type can be explicitly converted to a complete enumeration type. If the enumeration type has a fixed underlying type, the value is first converted to that type by integral conversion, if necessary, and then to the enumeration type.

Consider this example

enum A:int{};
char c = 0;
A a = static_cast<A>(c);

One integral type with a less integer conversion rank converts to another integral type with a greater integer conversion rank is considered Integral promotion, while Integral conversion does explicitly state that

The conversions allowed as integral promotions are excluded from the set of integral conversions.

I think we should need to add Integral promotion into [expr.static.cast#10] if such a conversion is necessary. It also should be the intent here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants