[Issue 6766] New: Forward reference error for default struct/class arguments
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Oct 4 09:35:47 PDT 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6766
Summary: Forward reference error for default struct/class
arguments
Product: D
Version: D2
Platform: Other
OS/Version: Windows
Status: NEW
Severity: normal
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: andrej.mitrovich at gmail.com
--- Comment #0 from Andrej Mitrovic <andrej.mitrovich at gmail.com> 2011-10-04 09:35:05 PDT ---
void test(Bar bar = Bar(1)) { }
struct Bar
{
this(int x) { }
}
void main() { }
Error: more initializers than fields of Bar
This also affects structs and classes that have methods with default arguments
that call ctors of typeof(this):
class Foo
{
this(int x) { }
void test(Foo foo = new Foo(1)) { }
}
struct Bar
{
this(int x) { }
void test(Bar bar = Bar(1)) { }
}
void main() {}
test.d(4): Error: no constructor for Foo
test.d(10): Error: more initializers than fields of Bar
--
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