Skip to content

Issue 10874 - conv.to ulong to int enum conversion #1505

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 1 commit into from
Aug 24, 2013

Conversation

quickfur
Copy link
Member

Don't assume that is(A : B) means a==b is valid, or that !is(A : B)
implies that a==b is invalid. Instead, test for a==b explicitly.

More specifically, int and ulong are ==-comparable, even though ulong is
not implicitly convertible to int. Thus, one should be able to convert
ulong to an int-based enum, but is(A : B) in the signature constraint
prohibits this. Testing for a==b explicitly, OTOH, makes this work.

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

Don't assume that is(A : B) means a==b is valid, or that !is(A : B)
implies that a==b is invalid. Instead, test for a==b explicitly.

More specifically, int and ulong are ==-comparable, even though ulong is
not implicitly convertible to int. Thus, one should be able to convert
ulong to an int-based enum, but is(A : B) in the signature constraint
prohibits this. Testing for a==b explicitly, OTOH, makes this work.
@monarchdodra
Copy link
Collaborator

LGTM

@monarchdodra
Copy link
Collaborator

Just gonna re-wait on the testers, since I just pulled you other std.conv pull. Just in case.

monarchdodra added a commit that referenced this pull request Aug 24, 2013
Issue 10874 - conv.to ulong to int enum conversion
@monarchdodra monarchdodra merged commit a184d6b into dlang:master Aug 24, 2013
@quickfur quickfur deleted the issue10874 branch July 16, 2014 05:01
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.

2 participants