diff options
| author | Richard Trieu <rtrieu@google.com> | 2011-09-26 22:38:21 +0000 |
|---|---|---|
| committer | Richard Trieu <rtrieu@google.com> | 2011-09-26 22:38:21 +0000 |
| commit | 1db746afbf8c71c5f287722eb229007fc9aa189b (patch) | |
| tree | 723e44cc74b23de6aa6900788531ad8766ded199 /clang/test/SemaCXX/warn-literal-conversion.cpp | |
| parent | 02bb7573fbef99a3b473a413be55e4234d4fd975 (diff) | |
| download | bcm5719-llvm-1db746afbf8c71c5f287722eb229007fc9aa189b.tar.gz bcm5719-llvm-1db746afbf8c71c5f287722eb229007fc9aa189b.zip | |
Move string literal to bool conversion into its own warning flag -Wstring-conversion.
llvm-svn: 140574
Diffstat (limited to 'clang/test/SemaCXX/warn-literal-conversion.cpp')
| -rw-r--r-- | clang/test/SemaCXX/warn-literal-conversion.cpp | 16 |
1 files changed, 0 insertions, 16 deletions
diff --git a/clang/test/SemaCXX/warn-literal-conversion.cpp b/clang/test/SemaCXX/warn-literal-conversion.cpp index c225aa4bf09..3fc8a6fec79 100644 --- a/clang/test/SemaCXX/warn-literal-conversion.cpp +++ b/clang/test/SemaCXX/warn-literal-conversion.cpp @@ -43,19 +43,3 @@ void test0() { int y = (24*60*60) * 0.25; int pennies = 123.45 * 100; } - -// Warn on cases where a string literal is converted into a bool. -// An exception is made for this in logical operators. -void assert(bool condition); -void test1() { - bool b0 = "hi"; // expected-warning{{implicit conversion turns string literal into bool: 'const char [3]' to 'bool'}} - b0 = ""; // expected-warning{{implicit conversion turns string literal into bool: 'const char [1]' to 'bool'}} - b0 = 0 && ""; - assert("error"); // expected-warning{{implicit conversion turns string literal into bool: 'const char [6]' to 'bool'}} - assert(0 && "error"); - - while("hi") {} // expected-warning{{implicit conversion turns string literal into bool: 'const char [3]' to 'bool'}} - do {} while("hi"); // expected-warning{{implicit conversion turns string literal into bool: 'const char [3]' to 'bool'}} - for (;"hi";); // expected-warning{{implicit conversion turns string literal into bool: 'const char [3]' to 'bool'}} - if("hi") {} // expected-warning{{implicit conversion turns string literal into bool: 'const char [3]' to 'bool'}} -} |

