Home | History | Annotate | Download | only in SemaCXX
      1 // RUN: %clang_cc1 -verify -fsyntax-only %s
      2 
      3 float foof(float x);
      4 double food(double x);
      5 void foo(bool b, float f);
      6 
      7 void bar() {
      8 
      9   float c = 1.7;
     10   bool b = c;
     11 
     12   double e = 1.7;
     13   b = e;
     14 
     15   b = foof(4.0);
     16 
     17   b = foof(c < 1); // expected-warning {{implicit conversion turns floating-point number into bool: 'float' to 'bool'}}
     18 
     19   b = food(e < 2); // expected-warning {{implicit conversion turns floating-point number into bool: 'double' to 'bool'}}
     20 
     21   foo(c, b);    // expected-warning {{implicit conversion turns floating-point number into bool: 'float' to 'bool'}}
     22   foo(c, c);
     23 
     24 }
     25