Thread overview
[Issue 1055] New: union forward reference "overlapping initialization" error
Mar 12, 2007
d-bugmail
Mar 12, 2007
d-bugmail
Mar 12, 2007
d-bugmail
Mar 13, 2007
d-bugmail
Mar 29, 2007
d-bugmail
Mar 27, 2010
Rainer Schuetze
May 10, 2010
Walter Bright
May 18, 2010
Don
March 12, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1055

           Summary: union forward reference "overlapping initialization"
                    error
           Product: D
           Version: 1.009
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla@digitalmars.com
        ReportedBy: wbaxter@gmail.com


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.


-- 

March 12, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1055


smjg@iname.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |smjg@iname.com
           Keywords|                            |rejects-valid




------- Comment #1 from smjg@iname.com  2007-03-12 11:50 -------
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.


-- 

March 12, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1055





------- Comment #2 from wbaxter@gmail.com  2007-03-12 17:33 -------
(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).


-- 

March 13, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1055





------- Comment #3 from smjg@iname.com  2007-03-12 21:21 -------
(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.


-- 

March 29, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1055


thomas-dloop@kuehne.cn changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         OS/Version|Windows                     |All




------- Comment #4 from thomas-dloop@kuehne.cn  2007-03-29 14:07 -------
Added to DStress as http://dstress.kuehne.cn/run/f/forward_reference_20_A.d http://dstress.kuehne.cn/run/f/forward_reference_20_B.d http://dstress.kuehne.cn/run/f/forward_reference_20_C.d http://dstress.kuehne.cn/run/f/forward_reference_20_D.d


-- 

March 27, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=1055


Rainer Schuetze <r.sagitario@gmx.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch
                 CC|                            |r.sagitario@gmx.de


--- Comment #5 from Rainer Schuetze <r.sagitario@gmx.de> 2010-03-27 06:26:03 PDT ---
although #945 seems completely unrelated, the patch there also fixes this issue including the dstress-tests.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 10, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=1055


Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla@digitalmars.com


--- Comment #6 from Walter Bright <bugzilla@digitalmars.com> 2010-05-10 11:49:37 PDT ---
changeset 478

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 18, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=1055


Don <clugdbug@yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |clugdbug@yahoo.com.au
         Resolution|                            |FIXED


--- Comment #7 from Don <clugdbug@yahoo.com.au> 2010-05-18 12:16:02 PDT ---
Fixed DMD1.061 and DMD2.046.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------