www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 10000] New: anonymous union returning wrong value when combined with CTFE

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

           Summary: anonymous union returning wrong value when combined
                    with CTFE
           Product: D
           Version: D2
          Platform: x86_64
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: moebiuspersona gmail.com



I have attached an example to this bug report. For whatever reason, when using
an anonymous union inside a struct and initializing a value from a constructor
argument, I'm seeing the wrong value. I first noticed it when trying to force
execution of my JSON library's parseJSON function at compile time using enum,
and I kept getting an empty object back.

This only seems to happen when mixing types in the union like numbers and
strings, arrays and numbers, etc. I ran the example with rdmd 2.062.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Apr 27 2013
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10000




Created an attachment (id=1211)
An example of the bug mentioned

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Apr 27 2013
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10000


Martin Nowak <code dawg.eu> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |code dawg.eu



Works in HEAD, but it would still be interesting to know what fixed the bug.

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