Implement a sub-group of -Wconversion: -Wliteral-conversion. This
specifically targets literals which are implicitly converted, a those
are more often unintended and trivial to fix. This can be especially
helpful for diagnosing what makes 'const int x = 1e6' not an ICE.
Original patch authored by Jim Meehan with contributions from other
Googlers and a few cleanups from myself.
llvm-svn: 125745
diff --git a/clang/test/Sema/knr-def-call.c b/clang/test/Sema/knr-def-call.c
index b23beb5..d054a04 100644
--- a/clang/test/Sema/knr-def-call.c
+++ b/clang/test/Sema/knr-def-call.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -Wconversion -fsyntax-only -verify %s
+// RUN: %clang_cc1 -Wconversion -Wliteral-conversion -fsyntax-only -verify %s
// C DR #316, PR 3626.
void f0(a, b, c, d) int a,b,c,d; {}
@@ -36,6 +36,6 @@
}
void use_proto() {
- proto(42.0); // expected-warning{{implicit conversion turns floating-point number into integer: 'double' to 'int'}}
- (&proto)(42.0); // expected-warning{{implicit conversion turns floating-point number into integer: 'double' to 'int'}}
+ proto(42.0); // expected-warning{{implicit conversion turns literal floating-point number into integer}}
+ (&proto)(42.0); // expected-warning{{implicit conversion turns literal floating-point number into integer}}
}