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
Add asOriginalType function for enums #5401
Conversation
Auto-merge toggled on |
Auto-merge toggled off |
I'm not sure I follow as to why this is fixing the linked bug when the bug talks about DMD giving no warning about the comparison of different enum types when this function is about enum manifest constants. |
@JackStouffer The idea is to have the error message say: "Cannot compare unrelated enums, use std.conv.representation to convert each or both to their representation type". |
This function gives a safe way to convert the enums being compared to a comparable type. |
Ah, ok. Be careful though, as Phobos already has a function called representation in std.string. |
Yah, the use of the same name is intentional. |
Let me rename it to |
8951b9c
to
c4bad1b
Compare
c4bad1b
to
bf43110
Compare
In order to fix https://issues.dlang.org/show_bug.cgi?id=6227, we need to recommend the appropriate way of comparing different enum types if the user wants so. This supports that.