Bug 6932 – Weird forward reference error

Status
RESOLVED
Resolution
WORKSFORME
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2011-11-11T11:26:00Z
Last change time
2015-06-09T05:11:45Z
Keywords
rejects-valid
Assigned to
nobody
Creator
hoganmeier

Comments

Comment #0 by hoganmeier — 2011-11-11T11:26:14Z
package mixin template CLWrapper(T, alias g) { package alias T CTypedontremovethis; } package struct CLObjectCollection(T) { this(T.CTypedontremovethis) { } } alias CLObjectCollection!CLDevice CLDevices; cl_errcode dontremovethis( ) {} struct CLDevice { mixin CLWrapper!(int, dontremovethis); } device.d(21): Error: mixin device.CLDevice.CLWrapper!(int,dontremovethis) forward reference of dontremovethis device.d(13): Error: template instance device.CLObjectCollection!(CLDevice) error instantiating E.g. removing the CLObjectCollection stuff "solves" it even though it isn't related at all.
Comment #1 by hsteoh — 2013-09-12T07:40:16Z
Tested on dmd git HEAD (6a90c4df): I couldn't compile the code snippet due to unrelated errors, so I inserted dummy definitions of cl_errcode and added a return statement to dontremovethis(). Here is the code I tested: ---- enum cl_errcode {A} package mixin template CLWrapper(T, alias g) { package alias T CTypedontremovethis; } package struct CLObjectCollection(T) { this(T.CTypedontremovethis) { } } alias CLObjectCollection!CLDevice CLDevices; cl_errcode dontremovethis( ) { return cl_errcode.A; } struct CLDevice { mixin CLWrapper!(int, dontremovethis); } ---- DMD git HEAD seems to be capable of compiling this correctly now, so I'm resolving this bug. Please reopen and post failing code if it still doesn't work for you. Thanks!