Bug 7152 – Can't assign null to default argument

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2011-12-22T03:33:00Z
Last change time
2013-01-10T00:55:31Z
Keywords
pull, rejects-valid
Assigned to
nobody
Creator
andrej.mitrovich

Comments

Comment #0 by andrej.mitrovich — 2011-12-22T03:33:12Z
struct Foo { this(void* a) { } void opAssign(void* a) { } } void test(Foo foo = null) { } // ng void main() { Foo foo = null; // ok }
Comment #1 by k.hara.pg — 2011-12-22T03:44:43Z
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 }
Comment #2 by andrej.mitrovich — 2012-12-23T06:17:08Z
*** This issue has been marked as a duplicate of issue 7019 ***
Comment #3 by k.hara.pg — 2013-01-08T17:45:14Z
This had not implemented as a part of issue 7019. https://github.com/D-Programming-Language/dmd/pull/1448
Comment #4 by github-bugzilla — 2013-01-10T00:46:15Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/e418d1e1072d4bf7254e759cdc0ad975d45ceed3 fix Issue 7152 - Can't assign null to default argument This had not implemented as a part of issue 7019. https://github.com/D-Programming-Language/dmd/commit/c7215bc74f0f80b248a69bc42ffbcecd97cc6faf Merge pull request #1448 from 9rnsr/fix7152 Issue 7152 - Can't assign null to default argument