[Issue 9519] constant bug in structures

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Feb 16 06:59:00 PST 2013


http://d.puremagic.com/issues/show_bug.cgi?id=9519


bearophile_hugs at eml.cc changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bearophile_hugs at eml.cc


--- Comment #1 from bearophile_hugs at eml.cc 2013-02-16 06:58:59 PST ---
The code on Codepad:



const ConstBug Poo = ConstBug(1, 1, 1); //This works fine

struct ConstBug
{
     float X, Y, Z;

     const ConstBug Test1 = ConstBug(0); //gives (0, NaN, NaN)
     const ConstBug Test2 = ConstBug(0, 0); //gives (0, 0, NaN) even as there
is no such construtor
     const ConstBug Test3 = ConstBug(1, 1, 1); //should give (2, 2, 2) but
gives (1, 1, 1)
     //const & immutable & static immutable gives all the same result

     this(float xyz)
     {
          X = xyz;
          Y = xyz;
          Z = xyz;
     }

     this(float x, float y, float z)
     {
          X = z * 2;
          Y = y * 2;
          Z = z * 2;
     }
}

-- 
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