[Issue 7152] Can't assign null to default argument

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Dec 22 03:44:52 PST 2011


http://d.puremagic.com/issues/show_bug.cgi?id=7152



--- Comment #1 from Kenji Hara <k.hara.pg at gmail.com> 2011-12-22 03:44:43 PST ---
This is a dup of 7019.
I'm not sure the implicit constructor call is allowed in default argument.

Workaround:

struct Foo
{
   this(int n) { }
   //void opAssign(void* a) { }  // not related to this issue.
}

//void test(Foo foo = null) { }  // ng
void test(Foo foo = Foo(null)) { }  // ok

void main()
{
   Foo foo = null;  // ok
}

-- 
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