diff options
author | dim <dim@FreeBSD.org> | 2011-10-20 21:14:49 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2011-10-20 21:14:49 +0000 |
commit | 3963a48221351c61c17fb3f382341ab04809a3d3 (patch) | |
tree | ee2483e98b09cac943dc93a6969d83ca737ff139 /test/Sema/conditional-expr.c | |
parent | 611ba3ea3300b71eb95dc4e45f20eee5dddd32e1 (diff) | |
download | FreeBSD-src-3963a48221351c61c17fb3f382341ab04809a3d3.zip FreeBSD-src-3963a48221351c61c17fb3f382341ab04809a3d3.tar.gz |
Vendor import of clang release_30 branch r142614:
http://llvm.org/svn/llvm-project/cfe/branches/release_30@142614
Diffstat (limited to 'test/Sema/conditional-expr.c')
-rw-r--r-- | test/Sema/conditional-expr.c | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/test/Sema/conditional-expr.c b/test/Sema/conditional-expr.c index 7a8c9e9..436ecdb 100644 --- a/test/Sema/conditional-expr.c +++ b/test/Sema/conditional-expr.c @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify -pedantic -Wsign-compare %s +// RUN: %clang_cc1 -fsyntax-only -verify -pedantic -Wsign-conversion %s void foo() { *(0 ? (double *)0 : (void *)0) = 0; // FIXME: GCC doesn't consider the the following two statements to be errors. @@ -36,12 +36,12 @@ void foo() { *(0 ? (asdf) 0 : &x) = 10; 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; @@ -49,12 +49,17 @@ void foo() { test0 = test0 ? (int) 10 : test0; test0 = test0 ? (short) 10 : test0; + int test1; enum Enum { EVal }; test0 = test0 ? EVal : test0; - test0 = test0 ? EVal : (int) test0; // okay: EVal is an int - test0 = test0 ? // expected-warning {{operands of ? are integers of different signs}} + test1 = test0 ? EVal : (int) test0; + test0 = test0 ? (unsigned) EVal - : (int) test0; + : (int) test0; // expected-warning {{operand of ? changes signedness: 'int' to 'unsigned long'}} + + 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'}} + } int Postgresql() { |