www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 12628] New: emplace does not work for rvalues

https://issues.dlang.org/show_bug.cgi?id=12628

          Issue ID: 12628
           Summary: emplace does not work for rvalues
           Product: D
           Version: unspecified
          Hardware: x86
                OS: Mac OS X
            Status: NEW
          Severity: normal
          Priority: P1
         Component: Phobos
          Assignee: nobody puremagic.com
          Reporter: andrei erdani.com

Consider:

#!/Users/aalexandre/bin/rdcc
import std.conv, std.stdio;

struct A
{
    A* next;
    bool b;
     disable this(this);
}

struct B
{
    A a;
}

void main()
{
    A a;
    emplace(&a, A(null, false));
    B b;
    emplace(&b, A());
}

Both calls fail to compile. These calls to emplace should work because they
don't need to postblit stuff around - they could just move from the rvalues
received.

--
Apr 23 2014