Thread overview
[Issue 10000] New: anonymous union returning wrong value when combined with CTFE
Apr 27, 2013
w0rp
Apr 27, 2013
w0rp
Apr 27, 2013
Martin Nowak
April 27, 2013
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


--- Comment #0 from w0rp <moebiuspersona@gmail.com> 2013-04-27 13:29:41 PDT ---
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: -------
April 27, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10000



--- Comment #1 from w0rp <moebiuspersona@gmail.com> 2013-04-27 13:33:18 PDT ---
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: -------
April 27, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10000


Martin Nowak <code@dawg.eu> changed:

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


--- Comment #2 from Martin Nowak <code@dawg.eu> 2013-04-27 14:48:19 PDT ---
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: -------