390 – Cannot forward reference enum nested in struct

D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 390 - Cannot forward reference enum nested in struct
Summary: Cannot forward reference enum nested in struct
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D1 (retired)
Hardware: x86 All
: P2 normal
Assignee: No Owner
URL:
Keywords: patch, rejects-valid
Depends on: 1160
Blocks: 340
Show dependency tree / graph
Reported: 2006年09月29日 19:40 UTC by Bradley Smith
Modified: 2014年02月15日 13:21 UTC (History)
3 users (show)

See Also:


Attachments
Add an attachment (proposed patch, testcase, etc.)

Note You need to log in before you can comment on or make changes to this issue.
Description Bradley Smith 2006年09月29日 19:40:27 UTC
$ 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 Bradley Smith 2006年09月30日 00:06:51 UTC
Fails on Windows XP also.
Comment 2 Stewart Gordon 2006年11月16日 18:39:55 UTC
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 Rainer Schuetze 2009年09月18日 01:00:45 UTC
The patch in issue 282 also fixes this issue.
Comment 4 Walter Bright 2009年12月31日 11:09:39 UTC
Fixed dmd 1.054 and 2.038


AltStyle によって変換されたページ (->オリジナル) /