Don <> changed:

           What    |Removed                     |Added
                 CC|                            |

--- Comment #1 from Don <> 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
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;

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:
------- You are receiving this mail because: -------

Reply via email to