Thread overview
[Issue 390] New: Cannot forward reference enum nested in struct
Sep 30, 2006
d-bugmail
Sep 30, 2006
d-bugmail
Nov 17, 2006
d-bugmail
Sep 18, 2009
Rainer Schuetze
Dec 31, 2009
Walter Bright
September 30, 2006
http://d.puremagic.com/issues/show_bug.cgi?id=390

           Summary: Cannot forward reference enum nested in struct
           Product: D
           Version: 0.167
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla@digitalmars.com
        ReportedBy: digitalmars-com@baysmith.com


$ 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);
}
----------


-- 

September 30, 2006
http://d.puremagic.com/issues/show_bug.cgi?id=390





------- Comment #1 from digitalmars-com@baysmith.com  2006-09-30 00:06 -------
Fails on Windows XP also.


-- 

November 17, 2006
http://d.puremagic.com/issues/show_bug.cgi?id=390





------- Comment #2 from smjg@iname.com  2006-11-16 18:39 -------
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;
    }
}
----------


-- 

September 18, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=390


Rainer Schuetze <r.sagitario@gmx.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch
                 CC|                            |r.sagitario@gmx.de


--- Comment #3 from Rainer Schuetze <r.sagitario@gmx.de> 2009-09-18 01:00:45 PDT ---
The patch in issue 282 also fixes this issue.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
December 31, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=390


Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla@digitalmars.com
         Resolution|                            |FIXED


--- Comment #4 from Walter Bright <bugzilla@digitalmars.com> 2009-12-31 11:09:39 PST ---
Fixed dmd 1.054 and 2.038

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------