www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 4671] New: std.conv.emplace() doesn't work w/ struct literals, as opposed to c'tors.

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4671

           Summary: std.conv.emplace() doesn't work w/ struct literals, as
                    opposed to c'tors.
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody puremagic.com
        ReportedBy: dsimcha yahoo.com


--- Comment #0 from David Simcha <dsimcha yahoo.com> 2010-08-17 18:18:26 PDT ---
import std.conv;

struct Foo {
    uint num;
}

void main() {
    Foo foo;
    auto voidArr = (cast(void*) &foo)[0..Foo.sizeof];
    emplace!(Foo)(voidArr, 2U);
}

d:\dmd2\windows\bin\..\..\src\phobos\std\conv.d(3805): Error: cannot implicitly
convert expression (_param_1) of type uint to Foo
d:\dmd2\windows\bin\..\..\src\phobos\std\conv.d(10): Error: template instance
std.conv.emplace!(Foo,uint) error instantiating

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Aug 17 2010
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4671


Andrei Alexandrescu <andrei metalanguage.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |andrei metalanguage.com
         Resolution|                            |FIXED


--- Comment #1 from Andrei Alexandrescu <andrei metalanguage.com> 2010-08-17
19:55:15 PDT ---
http://www.dsource.org/projects/phobos/changeset/1894
http://www.dsource.org/projects/phobos/changeset/1895

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