Skip to content

Commit

Permalink
Merge pull request #2844 from yebblies/issue10369
Browse files Browse the repository at this point in the history
Issue 10369 - Deprecate unordered floating point comparisons
  • Loading branch information
MartinNowak committed Dec 13, 2013
2 parents 0e583e5 + 97cebad commit 38e01f6
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/expression.c
Expand Up @@ -13292,6 +13292,12 @@ Expression *CmpExp::semantic(Scope *sc)

type = Type::tboolean;

if (op == TOKunord || op == TOKlg || op == TOKleg || op == TOKule ||
op == TOKul || op == TOKuge || op == TOKug || op == TOKue)
{
warning("use std.math.isNaN to deal with NaN operands rather than floating point operator '%s'", Token::toChars(op));
}

// Special handling for array comparisons
t1 = e1->type->toBasetype();
t2 = e2->type->toBasetype();
Expand Down

0 comments on commit 38e01f6

Please sign in to comment.