Bug 7915 – Forward reference to two-level nested static if symbols fails within struct
Status
RESOLVED
Resolution
DUPLICATE
Severity
regression
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-04-15T07:33:00Z
Last change time
2012-04-15T07:51:25Z
Keywords
rejects-valid
Assigned to
nobody
Creator
peter.alexander.au
Comments
Comment #0 by peter.alexander.au — 2012-04-15T07:33:07Z
This code fails in DMD 2.059, but worked in 2.058
-----------------------------
struct A
{
public:
static immutable A a = A(0);
static if (true)
static if (true)
this(int) {}
}
-----------------------------
% dmd test.d
test.d(4): Error: more initializers than fields (0) of A
-----------------------------
If you remove one of the static ifs, the error goes away.
If you move the definition of 'a' below the constructor, the error goes away.
In this case I am trying to forward reference a constructor, but it also happens with other symbols.
Comment #1 by peter.alexander.au — 2012-04-15T07:50:50Z
*** This issue has been marked as a duplicate of issue 7911 ***
Comment #2 by peter.alexander.au — 2012-04-15T07:51:25Z
(In reply to comment #1)
> *** This issue has been marked as a duplicate of issue 7911 ***
Apologies, didn't notice the duplicate.