Switch ignores case (?)
Chris via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Wed Nov 23 10:03:06 PST 2016
On Wednesday, 23 November 2016 at 17:33:04 UTC, Steven
Schveighoffer wrote:
>
> I tested this locally with different ideas. This definitely
> looks like a codegen bug.
>
> I was able to reduce it to:
>
> void main()
> {
> switch("'"d)
> {
> case "'"d:
> writeln("a");
> break;
> case "’"d:
> writeln("b");
> break;
> default:
> writeln("default");
> }
> }
>
> prints "default"
>
> What seems to fix it is removing the case statement for the
> "smart apostrophe". So I'd look there for where the bug is
> triggering.
>
> -Steve
Yep, removing one of the two cases works. I tried it with
different versions of dmd back to 2.070.0, and it always gives me
the same (wrong) result. I haven't tried ldc yet.
More information about the Digitalmars-d-learn
mailing list