[Issue 14402] std.conv.emplace segfaults for nested types

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Mon May 8 05:54:15 PDT 2017


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

Nick Treleaven <nick at geany.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|ice                         |accepts-invalid
                 CC|                            |nick at geany.org
           Assignee|nobody at puremagic.com        |nick at geany.org
            Summary|std.conv.emplace segfaults  |std.conv.emplace segfaults
                   |for nested class            |for nested types

--- Comment #3 from Nick Treleaven <nick at geany.org> ---
(In reply to Matt Kline from comment #1)
> Can we, via template magic or something similar, issue a
> similar error when trying to emplace one?

I think so, I'm working on a PR. Basically the initializer args have to contain
a type that has a usable context pointer. The remaining case is:

S s;
emplace(&s, S.init);

In solving that, I think disallowing rvalue initializers is too strict (as they
could have a valid context pointer). Perhaps this can be detected at runtime
instead.

--


More information about the Digitalmars-d-bugs mailing list