digitalmars.D.bugs - [Issue 13820] New: switch and case expressions should support alias
- via Digitalmars-d-bugs (40/40) Dec 04 2014 https://issues.dlang.org/show_bug.cgi?id=13820
https://issues.dlang.org/show_bug.cgi?id=13820 Issue ID: 13820 Summary: switch and case expressions should support alias this types Product: D Version: unspecified Hardware: x86_64 OS: Linux Status: NEW Severity: enhancement Priority: P1 Component: DMD Assignee: nobody puremagic.com Reporter: code dawg.eu cat > enh.d << CODE struct Foo { int val; alias val this; } void main() { auto foo = Foo(10); switch (foo) { case Foo(5): break; default: break; } } CODE dmd -c enh ---- enh.d(11): Error: 'foo' must be of integral or string type, it is a Foo enh.d(13): Error: case must be a string or an integral constant, not Foo(5) ---- The compiler should attempt to implicitly convert the expressions to an integral or string type. --
Dec 04 2014