Bug 5771 – Template constructor and auto ref do not work

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2011-03-23T07:00:00Z
Last change time
2011-05-28T15:12:01Z
Keywords
patch, rejects-valid
Assigned to
nobody
Creator
k.hara.pg

Comments

Comment #0 by k.hara.pg — 2011-03-23T07:00:57Z
Test code: ---- struct S { this(A)(auto ref A a){} // line 3 } void main() { S s = S(10); } ---- Line 3 causes error 'Error: auto can only be used for template function parameters'. Workaround is follows: ---- struct S { template __ctor(A){ // workaround ref typeof(this) __ctor(auto ref A a){ ...; return this; } } } ----
Comment #1 by k.hara.pg — 2011-04-16T19:30:15Z
Comment #2 by bugzilla — 2011-05-28T15:12:01Z