Skip to content

disallow nan and infinity in enum member #22022

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

Merged
merged 2 commits into from
May 23, 2018

Conversation

Kingwl
Copy link
Contributor

@Kingwl Kingwl commented Feb 18, 2018

Fixes #21959

btw:
IMO this is not a constant enum....

enum FMixed {
    Data1 = 10 + 0.0 / 0.0,
    Data2 = 0 / 0,
    Data3 = 10 / 0.0
}

@Kingwl Kingwl force-pushed the enum-eval-div-zero branch 2 times, most recently from 08c2c16 to 3d05e60 Compare February 19, 2018 11:20
@mhegazy mhegazy requested a review from weswigham April 5, 2018 17:13
@mhegazy
Copy link
Contributor

mhegazy commented Apr 5, 2018

@weswigham can you please review

@weswigham
Copy link
Member

@mhegazy did we only want to forbid this in const enums? I don't think having the restriction on normal enum initializers make sense, since they don't even need to be constant...

@mhegazy
Copy link
Contributor

mhegazy commented Apr 5, 2018

yeah. the original issue was for const enums really.

Copy link
Member

@weswigham weswigham left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We only want this error for const enums (enums with a const modifier, I mean), not all enums.

@mhegazy mhegazy closed this May 23, 2018
@mhegazy mhegazy reopened this May 23, 2018
@mhegazy mhegazy merged commit 10ac8b4 into microsoft:master May 23, 2018
@Kingwl Kingwl deleted the enum-eval-div-zero branch May 23, 2018 23:48
@microsoft microsoft locked and limited conversation to collaborators Jul 31, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants