Thread overview | |||||||
---|---|---|---|---|---|---|---|
|
November 19, 2006 [Issue 571] New: class instance member template returns strange value | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=571 Summary: class instance member template returns strange value Product: D Version: unspecified Platform: All OS/Version: All Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: bugzilla@digitalmars.com ReportedBy: lovesyao@hotmail.com class Test{ template test(){ const int test=1; } } void main(){ assert(Test.test!()==1);//ok assert((new Test).test!()==1);//failed } -- |
November 25, 2006 Re: [Issue 571] New: class instance member template returns strange value | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail Attachments: | d-bugmail@puremagic.com schrieb am 2006-11-19: > http://d.puremagic.com/issues/show_bug.cgi?id=571 > class Test{ > template test(){ > const int test=1; > } > } > > void main(){ > assert(Test.test!()==1);//ok > assert((new Test).test!()==1);//failed > } Added to DStress as http://dstress.kuehne.cn/run/t/template_47_A.d http://dstress.kuehne.cn/run/t/template_47_B.d Thomas |
June 30, 2008 [Issue 571] class instance member template returns strange value | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=571 ------- Comment #2 from bugzilla@digitalmars.com 2008-06-29 20:53 ------- This is invalid code in D 2.0, as templates cannot be used to add fields to a class. -- |
June 30, 2008 [Issue 571] class instance member template returns strange value | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=571 ------- Comment #3 from 2korden@gmail.com 2008-06-30 05:39 ------- Updated test case for D2: class Test { template test(){ enum int test = 1; // replace with const for D1 } } void main(){ printf("%d", (new Test()).test!()); } -- |
July 10, 2008 [Issue 571] class instance member template returns strange value | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=571 bugzilla@digitalmars.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED ------- Comment #4 from bugzilla@digitalmars.com 2008-07-09 22:36 ------- Fixed dmd 1.032 and 2.016 -- |
Copyright © 1999-2021 by the D Language Foundation