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


Don <clugd...@yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |clugd...@yahoo.com.au


--- Comment #1 from Don <clugd...@yahoo.com.au> 2010-10-06 23:57:21 PDT ---
This also applies to NaNs:

    assert( Foo( float.nan ) != Foo( float.nan ) ); // Works fine
    auto a = Foo( float.nan );
    auto b = Foo( float.nan );
    assert( b != a ); // Asserts

The real problem is e2ir.c, line 2313, EqualExp::toElem(), which does a bitwise
compare for structs. That isn't valid if there are floating point numbers
inside.
This is a pain, because it needs to be considered recursively.

A quick-and-dirty fix would be to construct an opEquals whenever this happens:

clone.c StructDeclaration::needOpEquals() line 106.

        if (tv->ty == Tstruct)
        {   TypeStruct *ts = (TypeStruct *)tv;
            StructDeclaration *sd = ts->sym;
            if (sd->eq)
                goto Lneed;
        }
+        if (tv->isfloating())
+            goto Lneed;
    }
Ldontneed:

But the problem with this is that it slows down all equality tests involving
floats. Maybe the inliner can take care of it, but generally I don't think it's
an acceptable solution.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------

Reply via email to