diff options
author | Richard Trieu <rtrieu@google.com> | 2011-07-21 02:46:28 +0000 |
---|---|---|
committer | Richard Trieu <rtrieu@google.com> | 2011-07-21 02:46:28 +0000 |
commit | 5254161b269829b74e7a9379b1bdfa27de72d7cc (patch) | |
tree | db6652f5ee355e0fe69b0d84b1c47ca4d39c1527 /test/SemaCXX/conditional-expr.cpp | |
parent | e081a61bb0dc546fd623bf259435d17c9a4ea0d5 (diff) |
Remove warning for conditional operands of differend signedness from -Wsign-compare. Cases that previously warn on this will have a different warning emitted from -Wsign-conversion.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135664 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaCXX/conditional-expr.cpp')
-rw-r--r-- | test/SemaCXX/conditional-expr.cpp | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/test/SemaCXX/conditional-expr.cpp b/test/SemaCXX/conditional-expr.cpp index b95700e9ba..fa5c974d1f 100644 --- a/test/SemaCXX/conditional-expr.cpp +++ b/test/SemaCXX/conditional-expr.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -fsyntax-only -verify -std=c++0x -Wsign-compare %s +// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -fsyntax-only -verify -std=c++0x -Wsign-conversion %s // C++ rules for ?: are a lot stricter than C rules, and have to take into // account more conversion options. @@ -180,12 +180,12 @@ void test() unsigned long test0 = 5; - test0 = test0 ? (long) test0 : test0; // expected-warning {{operands of ? are integers of different signs}} - test0 = test0 ? (int) test0 : test0; // expected-warning {{operands of ? are integers of different signs}} - test0 = test0 ? (short) test0 : test0; // expected-warning {{operands of ? are integers of different signs}} - test0 = test0 ? test0 : (long) test0; // expected-warning {{operands of ? are integers of different signs}} - test0 = test0 ? test0 : (int) test0; // expected-warning {{operands of ? are integers of different signs}} - test0 = test0 ? test0 : (short) test0; // expected-warning {{operands of ? are integers of different signs}} + test0 = test0 ? (long) test0 : test0; // expected-warning {{operand of ? changes signedness: 'long' to 'unsigned long'}} + test0 = test0 ? (int) test0 : test0; // expected-warning {{operand of ? changes signedness: 'int' to 'unsigned long'}} + test0 = test0 ? (short) test0 : test0; // expected-warning {{operand of ? changes signedness: 'short' to 'unsigned long'}} + test0 = test0 ? test0 : (long) test0; // expected-warning {{operand of ? changes signedness: 'long' to 'unsigned long'}} + test0 = test0 ? test0 : (int) test0; // expected-warning {{operand of ? changes signedness: 'int' to 'unsigned long'}} + test0 = test0 ? test0 : (short) test0; // expected-warning {{operand of ? changes signedness: 'short' to 'unsigned long'}} test0 = test0 ? test0 : (long) 10; test0 = test0 ? test0 : (int) 10; test0 = test0 ? test0 : (short) 10; @@ -193,8 +193,15 @@ void test() test0 = test0 ? (int) 10 : test0; test0 = test0 ? (short) 10 : test0; + int test1; test0 = test0 ? EVal : test0; - test0 = test0 ? EVal : (int) test0; + test1 = test0 ? EVal : (int) test0; + + test0 = test0 ? EVal : test1; // expected-warning {{operand of ? changes signedness: 'int' to 'unsigned long'}} + test0 = test0 ? test1 : EVal; // expected-warning {{operand of ? changes signedness: 'int' to 'unsigned long'}} + + test1 = test0 ? EVal : (int) test0; + test1 = test0 ? (int) test0 : EVal; // Note the thing that this does not test: since DR446, various situations // *must* create a separate temporary copy of class objects. This can only |