[Issue 21174] Recognize string value from string enum

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Aug 18 13:27:44 UTC 2020


https://issues.dlang.org/show_bug.cgi?id=21174

Simen Kjaeraas <simen.kjaras at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |simen.kjaras at gmail.com
         Resolution|---                         |INVALID

--- Comment #1 from Simen Kjaeraas <simen.kjaras at gmail.com> ---
E and E2 are different types from string, so when you check is(T == string),
you're explicitly disallowing them.

is(T1 == T2) is a lot stricter than calling fun(int) with a short value - it
asks 'are these types the same type?', and E and string simply are not.

You may have wanted to write is(T : string), which checks if E is implicitly
convertible to string, which it is. This compiles and runs.

--


More information about the Digitalmars-d-bugs mailing list