August 18, 2020 [Issue 21174] Recognize string value from string enum | ||||
|---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=21174 Simen Kjaeraas <simen.kjaras@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |simen.kjaras@gmail.com Resolution|--- |INVALID --- Comment #1 from Simen Kjaeraas <simen.kjaras@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. -- | ||||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply