[Issue 15396] New: static immutable not recognized as constant within switch statement
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Wed Dec 2 10:20:04 PST 2015
https://issues.dlang.org/show_bug.cgi?id=15396
Issue ID: 15396
Summary: static immutable not recognized as constant within
switch statement
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Keywords: rejects-valid
Severity: normal
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: mathias.lang at sociomantic.com
Test case:
`````
static immutable Foo = "Foobar";
void main (string[] args)
{
foreach (arg; args)
{
switch (arg)
{
case Foo:
assert(0);
default:
continue;
}
}
}
`````
This should be accepted by the compiler but it currently produces:
test.d(9): Error: case must be a string or an integral constant, not Foo
Tested with 2.066 and 2.069.
--
More information about the Digitalmars-d-bugs
mailing list