[Issue 5165] compiler add a cast and then complain that the cast have no effect, giving no .o file

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Nov 4 18:48:13 PDT 2010


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


Ellery Newcomer <ellery-newcomer at utulsa.edu> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ellery-newcomer at utulsa.edu


--- Comment #1 from Ellery Newcomer <ellery-newcomer at utulsa.edu> 2010-11-04 18:47:15 PDT ---
(In reply to comment #0)
> I try to compile, with dmd 1.065 the following:
> 
> ---
> struct u64_t{
>   uint lo;
>   uint hi;
> };
> 
> bool is_zero64(u64_t i)    {i.hi==0 && i.lo==0;}
> ---
> 
> but I get:
> [paul at Arcturus ~]$ dmd -c test.d
> test.d(7): Error: == has no effect in expression (i.lo == cast(uint)0)
> test.d(7): Error: function test.is_zero64 expected to return a value of type
> bool
> [paul at Arcturus ~]$ 
> 
> and I don't seems to find a way to rewrite this without the compiler refusing
> it.

sure you didn't mean

bool is_zero64(u64_t i)    {return i.hi==0 && i.lo==0;}

?

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