www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 7152] New: Can't assign null to default argument

reply d-bugmail puremagic.com writes:
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



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: -------
Dec 22 2011
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7152




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: -------
Dec 22 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
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



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: -------
Dec 23 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
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



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: -------
Jan 08 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7152




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


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: -------
Jan 10 2013
prev sibling parent d-bugmail puremagic.com writes:
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: -------
Jan 10 2013