Thread overview
[Issue 7152] New: Can't assign null to default argument
Dec 22, 2011
Andrej Mitrovic
Dec 22, 2011
Kenji Hara
Dec 23, 2012
Andrej Mitrovic
Jan 09, 2013
Kenji Hara
Jan 10, 2013
Denis Shelomovskij
December 22, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=7152

           Summary: Can't assign null to default argument
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: andrej.mitrovich@gmail.com


--- Comment #0 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2011-12-22 03:33:12 PST ---
struct Foo
{
    this(void* a) { }
    void opAssign(void* a) { }
}

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

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

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
December 22, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=7152



--- Comment #1 from Kenji Hara <k.hara.pg@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: -------
December 23, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7152


Andrej Mitrovic <andrej.mitrovich@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |DUPLICATE


--- Comment #2 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2012-12-23 06:17:08 PST ---
*** This issue has been marked as a duplicate of issue 7019 ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
January 09, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=7152


Kenji Hara <k.hara.pg@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull, rejects-valid
             Status|RESOLVED                    |REOPENED
           Platform|Other                       |All
         Resolution|DUPLICATE                   |
         OS/Version|Windows                     |All


--- Comment #3 from Kenji Hara <k.hara.pg@gmail.com> 2013-01-08 17:45:14 PST ---
This had not implemented as a part of issue 7019.

https://github.com/D-Programming-Language/dmd/pull/1448

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
January 10, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=7152



--- Comment #4 from github-bugzilla@puremagic.com 2013-01-10 00:46:15 PST ---
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

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
January 10, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=7152


Denis Shelomovskij <verylonglogin.reg@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
                 CC|                            |verylonglogin.reg@gmail.com
         Resolution|                            |FIXED


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------