Bug 1055 – union forward reference "overlapping initialization" error

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D1 (retired)
Platform
x86
OS
All
Creation time
2007-03-12T01:26:00Z
Last change time
2014-02-16T15:22:39Z
Keywords
patch, rejects-valid
Assigned to
nobody
Creator
wbaxter
Blocks
340

Comments

Comment #0 by wbaxter — 2007-03-12T01:26:35Z
New with DMD 1.009. This gives the error : struct overlapbug.Z overlapping initialization for struct Z.bar struct Z { int bar=1; union { FooT foo; } } struct FooT{ size_t offset=0;} But it works if you move "int bar=1" after the union. And it also works if you move the declaration of FooT before Z. Also this is one of those error messages that lacks an "Error" prefix in the message.
Comment #1 by smjg — 2007-03-12T11:50:15Z
Do you feel that every error message should have an "Error" prefix? Any particular reason? Personally, I think they're just as good or better without it. Moreover, even if we do have it, it should be part of the error output mechanism itself rather than of each error message. Making it so would be an enhancement request, separate from this bug.
Comment #2 by wbaxter — 2007-03-12T17:33:35Z
(In reply to comment #1) > Do you feel that every error message should have an "Error" prefix? Any > particular reason? There at least needs to be some easily greppable way to distinguish between the first line of an error and the continuation lines. One easy way to do that is to prefix every error with a sigil like "Error" "Warning" or "Information". This makes it possible for IDEs to automatically take you to errors in your source code and the lines they are on. And if they're all prefixed with "Error" vs "SomethingElse" then the IDE can also easily prioritize them so that it takes you to errors first and Warnings etc later (or never).
Comment #3 by smjg — 2007-03-12T21:21:21Z
(In reply to comment #2) > This makes it possible for IDEs to automatically take you to errors > in your source code and the lines they are on. TextPad manages without it. What's more, if only all filename/lineno references relevant to a single error are at the beginning of their lines, then it can pinpoint all these lines - whereas if it relied on seeing the word "Error", it probably wouldn't. But it took me a while to get it to work on warning messages, with their peculiar format. I recall that I managed to do it in the end but seem to have lost the regexp to do it. > And if they're all prefixed with "Error" vs "SomethingElse" then > the IDE can also easily prioritize them so that it takes you to > errors first and Warnings etc later (or never). Good point. But still, it would depend on the IDE whether it makes any real difference.
Comment #4 by thomas-dloop — 2007-03-29T14:07:02Z
Comment #5 by r.sagitario — 2010-03-27T06:26:03Z
although #945 seems completely unrelated, the patch there also fixes this issue including the dstress-tests.
Comment #6 by bugzilla — 2010-05-10T11:49:37Z
changeset 478
Comment #7 by clugdbug — 2010-05-18T12:16:02Z
Fixed DMD1.061 and DMD2.046.