1055 – union forward reference "overlapping initialization" error

D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 1055 - union forward reference "overlapping initialization" error
Summary: union forward reference "overlapping initialization" error
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D1 (retired)
Hardware: x86 All
: P2 normal
Assignee: No Owner
URL:
Keywords: patch, rejects-valid
Depends on:
Blocks: 340
Show dependency tree / graph
Reported: 2007年03月12日 01:26 UTC by Bill Baxter
Modified: 2014年02月16日 15:22 UTC (History)
4 users (show)

See Also:


Attachments
Add an attachment (proposed patch, testcase, etc.)

Note You need to log in before you can comment on or make changes to this issue.
Description Bill Baxter 2007年03月12日 01:26:35 UTC
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 Stewart Gordon 2007年03月12日 11:50:15 UTC
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 Bill Baxter 2007年03月12日 17:33:35 UTC
(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 Stewart Gordon 2007年03月12日 21:21:21 UTC
(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 5 Rainer Schuetze 2010年03月27日 06:26:03 UTC
although #945 seems completely unrelated, the patch there also fixes this issue including the dstress-tests.
Comment 6 Walter Bright 2010年05月10日 11:49:37 UTC
changeset 478
Comment 7 Don 2010年05月18日 12:16:02 UTC
Fixed DMD1.061 and DMD2.046.


AltStyle によって変換されたページ (->オリジナル) /