[Issue 7058] static initializer for structs doesn't respect init	values of members
    d-bugmail at puremagic.com 
    d-bugmail at puremagic.com
       
    Fri Dec  2 19:05:14 PST 2011
    
    
  
http://d.puremagic.com/issues/show_bug.cgi?id=7058
--- Comment #1 from Trass3r <mrmocool at gmx.de> 2011-12-02 19:04:09 PST ---
Interestingly enough, if you add a tuple it only respects the first value at
all:
void main()
{
    import std.stdio;
    vec3 v = {1.5f, 1.f, 0.5f};
    writeln(v);
}
template Tuple(T...)
{
    alias T Tuple;
}
template Repeat(T, int count)
{
    static if (!count)
        alias Tuple!() Repeat;
    else
        alias Tuple!(T, Repeat!(T, count-1)) Repeat;
}
struct vec3
{
    union
    {
        struct
        {
            float x = 0;
            float y = 0;
            float z = 0;
        }
//        float[3] cell;
        Repeat!(float, 3) tuple;
    }
}
$ dmd -run vector.d
vec3(1.5, nan, nan, 1.5, nan, nan)
-- 
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