www.digitalmars.com         C & C++   DMDScript  

D.gnu - [Bug 86] New: initializing of templated struct with union fails

http://bugzilla.gdcproject.org/show_bug.cgi?id=86


           Summary: initializing of templated struct with union fails
    Classification: Unclassified
           Product: GDC
           Version: 4.8.x
          Platform: x86_64
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: Normal
         Component: gdc
        AssignedTo: ibuclaw gdcproject.org
        ReportedBy: dbugreporter gmail.com


Created attachment 54
  --> http://bugzilla.gdcproject.org/attachment.cgi?id=54
templated struct with union, inits fail, errors/wrong data

I have a templated Vector struct with a union in it. Init of a global Vector
instance like so:

    immutable up = vec4(0, 1, 0, 0);

won't compile with gdc: 'duplicate union initialization for comps'. Inside a
function, it works however. Init like:

    enum up = vec4(0, 1, 0, 0);

will result in a vector with all values being nan (in both global and local
scope).

I have minimized everything into one file.

gdc (Ubuntu 4.8.1-2ubuntu1~13.04) 4.8.1

x86_64 GNU/Linux

-- 
Configure bugmail: http://bugzilla.gdcproject.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching all bug changes.
Dec 23 2013