Bug 10973 – emplace internal error

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-09-05T10:27:00Z
Last change time
2013-10-20T06:30:31Z
Assigned to
monarchdodra
Creator
monarchdodra

Comments

Comment #0 by monarchdodra — 2013-09-05T10:27:26Z
Conditions: Use aggregate initialization on a structure that has a static array, while making the argument an element type of the array. EG: //---- import std.conv; struct S { int i; int[2] ii; } void main() { S s = S(1, 2); //OK emplace(&s, 1, 2); //Chokes } //---- The issue is in "emplacePostblitter", which is confused when it is asked to postblit a type over something that isn't the same type. "Luckilly", compilation stops, instead of potentially doing wrong code. On topic, I'm really not a huge fan of "S s = S(1, 2); //OK": This is basically implicit promotion from "int" to "int[2]". D usually bans implicit pormotion, and *every time* I have seen this "aggregate initialization with static array promotion" "feature" I (and others on the boards) have been surprised by it. Introduced by pull: https://github.com/D-Programming-Language/phobos/pull/1082
Comment #1 by monarchdodra — 2013-09-06T08:09:50Z
While I am at it: emplacePostblitter does not correctly handle class types either, if one of the nested members is a class.
Comment #2 by bugzilla — 2013-10-08T02:12:00Z
(In reply to comment #0) > Introduced by pull: > https://github.com/D-Programming-Language/phobos/pull/1082 It's getting close to beta time. We should either revert this pull to fix the regression, or fix it.
Comment #3 by monarchdodra — 2013-10-08T03:42:09Z
Hum. I forgot to link back. First, this is a trivial reformat: https://github.com/D-Programming-Language/phobos/pull/1552 Then, this fixes the issues 10973 and 10978: https://github.com/D-Programming-Language/phobos/pull/1567 In parallel: This adds only extra unittests, that proves "array" works better than before: https://github.com/D-Programming-Language/phobos/pull/1528 This fixes "appender" to correctly use emplace, which fixes a bug we are regularly hitting: https://github.com/D-Programming-Language/phobos/pull/1529 It just needs some reviewing now.
Comment #4 by monarchdodra — 2013-10-20T03:34:09Z
(In reply to comment #3) > Hum. I forgot to link back. > > First, this is a trivial reformat: > https://github.com/D-Programming-Language/phobos/pull/1552 Pulled > Then, this fixes the issues 10973 and 10978: > https://github.com/D-Programming-Language/phobos/pull/1567 Relocated: https://github.com/D-Programming-Language/phobos/pull/1629 > In parallel: > This adds only extra unittests, that proves "array" works better than before: > https://github.com/D-Programming-Language/phobos/pull/1528 Pulled > This fixes "appender" to correctly use emplace, which fixes a bug we are > regularly hitting: > https://github.com/D-Programming-Language/phobos/pull/1529 Still open.
Comment #5 by code — 2013-10-20T06:27:20Z
Comment #6 by code — 2013-10-20T06:30:31Z