static assert(is(typeof(x)==const(int))); // pass static assert(!is(typeof({x=2;}))); // pass pragma(msg, typeof(x)); // "int" pragma(msg, is(typeof({x=2;}))); // "true" const int x; pragma(msg, typeof(x)); // "const(int)" pragma(msg, is(typeof({x=2;}))); // "false"
I don't understand. I have to add const int x; at the beginning in order for this test to pass. Then I get: PS E:\DigitalMars\dmd2\samples> dmd -c bug.d const(int) false bug.d(11): Error: declaration bug.main.x is already defined const(int) false
There is no 'main' in the test case in the bug report. The declarations reside at module scope. To clarify: the issue is that the first two pragma(msg,...) print a wrong value.
Fixed in v2.084: ``` 2.063 to 2.083.1: Success with output: ----- int true const(int) false ----- Since 2.084.1: Success with output: ----- const(int) false const(int) false ----- ```