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

Issue 4958 - Floating point enums should check for total loss of precision #671

Merged
merged 1 commit into from
Feb 25, 2012

Conversation

yebblies
Copy link
Member

@yebblies yebblies commented Feb 1, 2012

This is Don's fix from the bug report. Issue an error if last+1 == last when assigning values to enum members.

http://d.puremagic.com/issues/show_bug.cgi?id=4958

@@ -231,6 +231,13 @@ void EnumDeclaration::semantic(Scope *sc)
e = e->semantic(sce);
e = e->castTo(sce, elast->type);
e = e->optimize(WANTvalue | WANTinterpret);

Copy link
Member

Choose a reason for hiding this comment

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

How about if (t->isfloating())?
And while your at it you could cache that t->getProperty(0, Id::max) 5 lines above.

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure, why not.

…ision

This is Don's fix from the bug report.  Issue an error if last+1 == last when assigning values to enum members.
WalterBright added a commit that referenced this pull request Feb 25, 2012
Issue 4958 - Floating point enums should check for total loss of precision
@WalterBright WalterBright merged commit f9c2d24 into dlang:master Feb 25, 2012
braddr pushed a commit to braddr/dmd that referenced this pull request Oct 22, 2012
Use errno property instead of setErrno in std.path.
@yebblies yebblies deleted the issue4958 branch November 22, 2013 08:42
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 this pull request may close these issues.

3 participants