[Issue 20613] String switch in -betterC fails for 7+ labels
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Feb 27 16:19:15 UTC 2020
https://issues.dlang.org/show_bug.cgi?id=20613
--- Comment #3 from Steven Schveighoffer <schveiguy at yahoo.com> ---
(In reply to Steven Schveighoffer from comment #2)
> I'm not sure why Martin did it the way he did. I'll ask him.
No response from him, but I tried using your suggestion. It doesn't work
(std.datetime fails to compile).
The issue is that the template is passed in the string literals as the type of
the value to switch on. So if you pass in a const(char)[] to test, the literals
are passed in as const(char)[].
Which means, even though they are compile-time literals, they don't convert to
immutable(char)[].
But I have found an answer that is less complex and just uses a cast. PR
imminent.
--
More information about the Digitalmars-d-bugs
mailing list