March 05, 2006 [Bug 15] New: Problem with inner struct templates | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/bugzilla/show_bug.cgi?id=15 Summary: Problem with inner struct templates Product: D Version: 0.148 Platform: PC OS/Version: Windows Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: walter@digitalmars.com ReportedBy: sean@f4.ca Don's comment about how D templates are resolved during compilation instead of optimization got me thinking whether the traditional get/set accessor method for tuples could be replaced by a simple alias, which seems ideal as it doesn't rely on inlining to make the resulting code efficient. What follows is an attempt at this, first with a class, then with a struct. Note that the class version compiles but the struct version breaks. I assume this is a bug? C:\code\d>type test.d void main() { ClassOf!(int) c = new ClassOf!(int)(); StructOf!(int) s; int x; c.ref!() = x; x = c.ref!(); s.ref!() = x; x = s.ref!(); } class ClassOf(Type) { Type val; template ref() { alias val ref; } } template StructOf( Type ) { struct StructOf { Type val; template ref() { alias val ref; } } } C:\code\d>dmd test.d test.d(10): this for val needs to be type StructOf not type StructOf C:\code\d> DStress test cases: http://dstress.kuehne.cn/run/a/alias_31_A.d http://dstress.kuehne.cn/run/a/alias_31_B.d http://dstress.kuehne.cn/run/a/alias_31_C.d http://dstress.kuehne.cn/run/a/alias_31_D.d -- |
April 28, 2006 [Bug 15] Problem with inner struct templates | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/bugzilla/show_bug.cgi?id=15 bugzilla@digitalmars.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED ------- Comment #1 from bugzilla@digitalmars.com 2006-04-28 02:54 ------- Fixed 0.155 -- |
Copyright © 1999-2021 by the D Language Foundation