Bug 390 – Cannot forward reference enum nested in struct

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D1 (retired)
Platform
x86
OS
All
Creation time
2006-09-29T19:40:00Z
Last change time
2014-02-15T13:21:43Z
Keywords
patch, rejects-valid
Assigned to
nobody
Creator
digitalmars-com
Depends on
1160
Blocks
340

Comments

Comment #0 by digitalmars-com — 2006-09-29T19:40:27Z
$ dmd testStructEnum.d testStructEnum.d(6): no property 'Id' for type 'Value' testStructEnum.d(6): Value.Id is used as a type testStructEnum.d(6): cannot have parameter of type void $ dmd testStructEnum.d -version=works gcc testStructEnum.o -o testStructEnum -m32 -lphobos -lpthread -lm -Xlinker -L/home/bsmith/tools/d/dmd/lib $ ./testStructEnum 1 ----- testStructEnum.d ----- import std.stdio; version(works) { } else { // Doesn't work void f(Value.Id t) { writefln(cast(int)t); } } struct Value { public static enum Id { A, B } } version(works) { void f(Value.Id t) { writefln(cast(int)t); } } void main() { Value.Id t = Value.Id.B; f(t); } ----------
Comment #1 by digitalmars-com — 2006-09-30T00:06:51Z
Fails on Windows XP also.
Comment #2 by smjg — 2006-11-16T18:39:55Z
It also fails with a struct nested within a struct. Probably part of the same bug. IIRC class within struct, struct within class and class within class all fail. ---------- struct Qwert { Yuiop.Asdfg hjkl; } struct Yuiop { struct Asdfg { int zxcvb; } } ----------
Comment #3 by r.sagitario — 2009-09-18T01:00:45Z
The patch in issue 282 also fixes this issue.
Comment #4 by bugzilla — 2009-12-31T11:09:39Z
Fixed dmd 1.054 and 2.038