http://d.puremagic.com/issues/show_bug.cgi?id=6635

           Summary: std.conv.emplace: enforcement is too weak
           Product: D
           Version: unspecified
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nob...@puremagic.com
        ReportedBy: timon.g...@gmx.ch


--- Comment #0 from timon.g...@gmx.ch 2011-09-09 05:35:09 PDT ---
T emplace(T, Args...)(void[] chunk, Args args) if (is(T == class))
{
    enforce(chunk.length >= __traits(classInstanceSize, T),
           new ConvException("emplace: chunk size too small"));
    auto a = cast(size_t) chunk.ptr;

    enforce(a % T.alignof == 0, text(a, " vs. ", T.alignof));
    ...
}

T.alignof is the alignment of the class reference, always equal to
size_t.sizeof, not the alignment of the class instance.

A class instance can require a larger alignment in some cases, eg. if it has
fields with larger alignments.

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

Reply via email to