[Issue 5771] New: Template constructor auto ref and do not work
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Mar 23 07:04:15 PDT 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5771
Summary: Template constructor auto ref and do not work
Product: D
Version: D2
Platform: All
OS/Version: All
Status: NEW
Severity: normal
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: k.hara.pg at gmail.com
--- Comment #0 from Kenji Hara <k.hara.pg at gmail.com> 2011-03-23 07:00:57 PDT ---
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; }
}
}
----
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list