Bug 7846 – Forward referenced storage class is not applied in certain cases

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-04-06T02:26:03Z
Last change time
2020-08-04T03:40:31Z
Assigned to
No Owner
Creator
timon.gehr

Comments

Comment #0 by timon.gehr — 2012-04-06T02:26:03Z
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"
Comment #1 by lovelydear — 2012-04-21T11:03:06Z
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
Comment #2 by timon.gehr — 2012-04-21T11:08:46Z
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.
Comment #3 by pro.mathias.lang — 2020-08-04T03:40:31Z
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 ----- ```