1 // RUN: %clang_cc1 -verify -fsyntax-only %s -Wdouble-promotion 2 3 float ReturnFloatFromDouble(double d) { 4 return d; 5 } 6 7 float ReturnFloatFromLongDouble(long double ld) { 8 return ld; 9 } 10 11 double ReturnDoubleFromLongDouble(long double ld) { 12 return ld; 13 } 14 15 double ReturnDoubleFromFloat(float f) { 16 return f; //expected-warning{{implicit conversion increases floating-point precision: 'float' to 'double'}} 17 } 18 19 long double ReturnLongDoubleFromFloat(float f) { 20 return f; //expected-warning{{implicit conversion increases floating-point precision: 'float' to 'long double'}} 21 } 22 23 long double ReturnLongDoubleFromDouble(double d) { 24 return d; //expected-warning{{implicit conversion increases floating-point precision: 'double' to 'long double'}} 25 } 26 27 void Convert(float f, double d, long double ld) { 28 d = f; //expected-warning{{implicit conversion increases floating-point precision: 'float' to 'double'}} 29 ld = f; //expected-warning{{implicit conversion increases floating-point precision: 'float' to 'long double'}} 30 ld = d; //expected-warning{{implicit conversion increases floating-point precision: 'double' to 'long double'}} 31 f = d; 32 f = ld; 33 d = ld; 34 } 35