xref: /minix3/external/bsd/llvm/dist/clang/test/SemaCXX/warn-float-conversion.cpp (revision bdb565187c0f1a04513dd488df843317b27f86c8)
1 // RUN: %clang_cc1 -verify -fsyntax-only %s -Wfloat-conversion
2 
3 bool ReturnBool(float f) {
4   return f;  //expected-warning{{conversion}}
5 }
6 
7 char ReturnChar(float f) {
8   return f;  //expected-warning{{conversion}}
9 }
10 
11 int ReturnInt(float f) {
12   return f;  //expected-warning{{conversion}}
13 }
14 
15 long ReturnLong(float f) {
16   return f;  //expected-warning{{conversion}}
17 }
18 
19 void Convert(float f, double d, long double ld) {
20   bool b;
21   char c;
22   int i;
23   long l;
24 
25   b = f;  //expected-warning{{conversion}}
26   b = d;  //expected-warning{{conversion}}
27   b = ld;  //expected-warning{{conversion}}
28   c = f;  //expected-warning{{conversion}}
29   c = d;  //expected-warning{{conversion}}
30   c = ld;  //expected-warning{{conversion}}
31   i = f;  //expected-warning{{conversion}}
32   i = d;  //expected-warning{{conversion}}
33   i = ld;  //expected-warning{{conversion}}
34   l = f;  //expected-warning{{conversion}}
35   l = d;  //expected-warning{{conversion}}
36   l = ld;  //expected-warning{{conversion}}
37 }
38 
39