[Issue 6629] New: std.conv.emplace: enforcement is too weak
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Sep 8 15:35:41 PDT 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6629
Summary: std.conv.emplace: enforcement is too weak
Product: D
Version: D2
Platform: Other
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P2
Component: Phobos
AssignedTo: nobody at puremagic.com
ReportedBy: timon.gehr at gmx.ch
--- Comment #0 from timon.gehr at gmx.ch 2011-09-08 15:35:28 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, not the class instance.
Classes have to be 16-byte aligned, but the enforcement checks only for 4 byte
alignment. This results in segmentation faults in user code, even though the
function performs checks.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list