blob: 60f971c6df97fe8893f4974df158a93f144c2b1f [file] [log] [blame]
Shih-wei Liaoea285162010-06-04 12:34:56 -07001// RUN: %clang_cc1 -fsyntax-only -Wfloat-equal -verify %s
2
3int f1(float x, float y) {
4 return x == y; // expected-warning {{comparing floating point with ==}}
5}
6
7int f2(float x, float y) {
8 return x != y; // expected-warning {{comparing floating point with ==}}
9}
10
11int f3(float x) {
12 return x == x; // no-warning
13}
14
15int f4(float x) {
16 return x == 0.0; // no-warning {{comparing}}
17}
18
19int f5(float x) {
20 return x == __builtin_inf(); // no-warning
21}
22
23int f7(float x) {
24 return x == 3.14159; // expected-warning {{comparing}}
25}