www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 16105] New: `is` fails for init value of struct with float


          Issue ID: 16105
           Summary: `is` fails for init value of struct with float
           Product: D
           Version: D2
          Hardware: x86_64
               URL: https://forum.dlang.org/post/jzgwikubjfmlcdgpierj foru
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: schuetzm gmx.net

The following test case only prints "B: works", although the first comparison
should succeed, too:

import std.stdio;

struct Foo
    int x;
    float f;

void main()
    Foo foo;
    if(foo is Foo.init) "A: doesn't work".writeln;
    foo = Foo();
    if(foo is Foo.init) "B: works".writeln;

Found by ArturG:
https://forum.dlang.org/post/jzgwikubjfmlcdgpierj forum.dlang.org

May 31 2016