www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 2686] New: Invalid union initializer is accepted

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2686

           Summary: Invalid union initializer is accepted
           Product: D
           Version: 1.040
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Keywords: accepts-invalid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: snake.scaly gmail.com


------8<------- bug.d ----
static import std.stdio;
union A {
  short a;
  long b;
}
void main() {
  A x = 0x12345;
  std.stdio.writefln("a %s, b %s", x.a, x.b);
}
------8<------- bug.d ----

 dmd -run bug.d
a 0, b 0 A simple numeric initializer is accepted but union members are not initialized accordingly. This should be a compile-time error. --
Feb 24 2009
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2686


Don <clugdbug yahoo.com.au> changed:

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



This was fixed in DMD1.050

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