www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Bug 59] New: implicit conversion from integer to cfloat not caught by the compiler

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/bugzilla/show_bug.cgi?id=59

           Summary: implicit conversion from integer to cfloat not caught by
                    the compiler
           Product: D
           Version: 0.150
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: thomas-dloop kuehne.cn


cfloat c;
c = 0.0; // should fail to compile

test cases:
http://dstress.kuehne.cn/nocompile/c/cfloat_10_A.d
http://dstress.kuehne.cn/nocompile/c/cfloat_10_B.d
http://dstress.kuehne.cn/nocompile/c/cdouble_10_A.d
http://dstress.kuehne.cn/nocompile/c/cdouble_10_B.d
http://dstress.kuehne.cn/nocompile/c/creal_35_A.d
http://dstress.kuehne.cn/nocompile/c/creal_35_B.d


-- 
Mar 20 2006
parent reply d-bugmail puremagic.com writes:
http://d.puremagic.com/bugzilla/show_bug.cgi?id=59


smjg iname.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |smjg iname.com




------- Comment #1 from smjg iname.com  2006-05-18 08:54 -------
Make up your mind - are we talking about integers or floating points here?


-- 
May 18 2006
parent Thomas Kuehne <thomas-dloop kuehne.cn> writes:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

d-bugmail puremagic.com schrieb am 2006-05-18:
 ------- Comment #1 from smjg iname.com  2006-05-18 08:54 -------
 Make up your mind - are we talking about integers or floating points here?

Thanks for catching this. In contrast to the documentation the compiler allows implicity promoting integers to complex floats. creal c = 1; // should fail to compile Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFEbbmB3w+/yD4P9tIRAp86AJ9XbD108t6opHbrTJjOv88wE4N32ACdHl3S xU7VhImJz6VmHfKI7biZS20= =A6n7 -----END PGP SIGNATURE-----
May 19 2006