June 06, 2014 [Issue 12864] New: can no longer use toLower in string switch case | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=12864 Issue ID: 12864 Summary: can no longer use toLower in string switch case Product: D Version: unspecified Hardware: x86_64 OS: Linux Status: NEW Severity: regression Priority: P1 Component: DMD Assignee: nobody@puremagic.com Reporter: code@dawg.eu cat > bug.d << CODE import std.string; enum name = "Name"; void color(string s) { switch (s) { case name.toLower(): break; default: break; } } CODE dmd -c bug ---- bug.d(9): Error: case must be a string or an integral constant, not ['n', 'a', 'm', 'e'] ---- This is because toLower now uses appender internally. The bug seems to be that CTFE doesn't recognize char arrays from appender as strings. -- |
Copyright © 1999-2021 by the D Language Foundation