[Issue 6681] struct constructor call is converted to struct literal that breaks union initialization
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Feb 1 04:10:12 PST 2012
http://d.puremagic.com/issues/show_bug.cgi?id=6681
yebblies <yebblies at gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Platform|Other |All
Summary|bogus duplicate union |struct constructor call is
|initialization or |converted to struct literal
|overlapping initialization |that breaks union
|errors |initialization
OS/Version|Mac OS X |All
--- Comment #3 from yebblies <yebblies at gmail.com> 2012-02-01 23:10:11 EST ---
Got my test cases a little mixed up there, but it's still mostly valid.
All of the non-struct-literal struct construction seems to be converted into
struct literals. eg.
struct S
{
this(int a, int b) { this.a = b; this.b = a; }
union {
ulong g;
struct {int a, b; };
}
}
static immutable S s = S(0, 1);
Prints: (with a little extra debug output)
StructLiteralExp::semantic('S(0LU,1,0)')
S
Error: duplicate union initialization for a
Error: duplicate union initialization for b
As you can see, it make a struct literal with every field accounted for.
So this is a bug in the constfolding/ctfe code.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list