digitalmars.D.bugs - [Issue 1160] New: enums can not be forward referenced
- d-bugmail puremagic.com (22/22) Apr 18 2007 http://d.puremagic.com/issues/show_bug.cgi?id=1160
- d-bugmail puremagic.com (30/30) Jan 10 2008 http://d.puremagic.com/issues/show_bug.cgi?id=1160
- d-bugmail puremagic.com (5/5) Jan 15 2008 http://d.puremagic.com/issues/show_bug.cgi?id=1160
- d-bugmail puremagic.com (6/6) Dec 29 2009 http://d.puremagic.com/issues/show_bug.cgi?id=1160
- d-bugmail puremagic.com (11/11) Dec 31 2009 http://d.puremagic.com/issues/show_bug.cgi?id=1160
http://d.puremagic.com/issues/show_bug.cgi?id=1160 Summary: enums can not be forward referenced Product: D Version: 1.012 Platform: PC OS/Version: All Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: bugzilla digitalmars.com ReportedBy: aarti interia.pl //related to: http://dstress.kuehne.cn/run/forward_reference_[07-11].d //doesn't work in almost all contexts interface Test { Policy fn(); } //same for classes, unions and structs enum Policy {Default, Cached, Direct} void main() { } --
Apr 18 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1160 ------- Comment #1 from tomas famolsen.dk 2008-01-10 16:52 ------- the simplest test case is something like this: X x; enum X { Y }; Fails to compile with 'enum is forward referenced' error. This issue came up on IRC and I decided to take a look what was going on. The issue is that the basetype cannot be resolved. A working workaround is: X x; enum X : int { Y }; This patch (against LLVMDC, might not match 100%) ... Index: dmd/declaration.c =================================================================== --- dmd/declaration.c (revision 135) +++ dmd/declaration.c (working copy) -642,6 +642,7 Dsymbol *parent = toParent(); FuncDeclaration *fd = parent->isFuncDeclaration(); + type->semantic(loc,sc); Type *tb = type->toBasetype(); if (tb->ty == Tvoid && !(storage_class & STClazy)) { error("voids have no value"); ... also fixes the problem. I have no idea what other problems it might introduce though... Also I doubt it will fix all the variations of this issue. I haven't looked enough at the semantics code in DMD to fix this properly. However, this seems like something that shouldn't be *that* hard to fix... Why not put in the works for Type::toBaseType to be able to run semantics? Please enlighten me (us) as to why this is implemented as it is right now! --
Jan 10 2008
http://d.puremagic.com/issues/show_bug.cgi?id=1160 ------- Comment #2 from bugzilla digitalmars.com 2008-01-15 04:07 ------- The patch doesn't work generally because the context (sc) for the type may be very different from the context for the enum. --
Jan 15 2008
http://d.puremagic.com/issues/show_bug.cgi?id=1160 --- Comment #3 from Walter Bright <bugzilla digitalmars.com> 2009-12-29 03:19:59 PST --- Changeset 318 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Dec 29 2009
http://d.puremagic.com/issues/show_bug.cgi?id=1160 Walter Bright <bugzilla digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED --- Comment #4 from Walter Bright <bugzilla digitalmars.com> 2009-12-31 11:10:28 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: -------
Dec 31 2009