On Friday, 10 August 2012 at 09:27:25 UTC, Daniel Kozak wrote:

Summary: Float types default initializers doesn't work in class
           Product: D
           Version: D2
          Platform: x86_64
        OS/Version: Linux
            Status: NEW
          Severity: major
          Priority: P2
         Component: DMD
        AssignedTo: nob...@puremagic.com
        ReportedBy: kozz...@gmail.com

--- Comment #0 from Daniel Kozak <kozz...@gmail.com> 2012-08-10 02:27:21 PDT ---
Created an attachment (id=1136)
problematic code

When I create class with some float variable without value, then call some method on this class and test float variable for default value, it doesnt work.

My code is in in attachment

Problematic code:
module main;

import std.stdio;

class A {
        private float floatInClass;
        public void tryfloatInitValue() {
                float floatInLocalScope;
                if (floatInClass is float.init) {
                        writeln("floatInClass OK");
                } else {
                        writeln("floatInClass ERR");
                if (floatInLocalScope is float.init) {
                        writeln("floatInLocalScope OK");
                } else {
                        writeln("floatInLocalScope ERR");

void main(string[] args)
        A smth = new A();

Same for double, but for real type it is ok

Reply via email to