diff options
Diffstat (limited to 'test/SemaCXX')
-rw-r--r-- | test/SemaCXX/compare.cpp | 20 | ||||
-rw-r--r-- | test/SemaCXX/conditional-expr.cpp | 17 |
2 files changed, 27 insertions, 10 deletions
diff --git a/test/SemaCXX/compare.cpp b/test/SemaCXX/compare.cpp index cd243e3d6b..4790347220 100644 --- a/test/SemaCXX/compare.cpp +++ b/test/SemaCXX/compare.cpp @@ -19,8 +19,8 @@ int test0(long a, unsigned long b) { ((signed char) a == b) + // expected-warning {{comparison of integers of different signs}} ((long) a == (unsigned long) b) + // expected-warning {{comparison of integers of different signs}} ((int) a == (unsigned int) b) + // expected-warning {{comparison of integers of different signs}} - ((short) a == (unsigned short) b) + // expected-warning {{comparison of integers of different signs}} - ((signed char) a == (unsigned char) b) + // expected-warning {{comparison of integers of different signs}} + ((short) a == (unsigned short) b) + + ((signed char) a == (unsigned char) b) + (a < (unsigned long) b) + // expected-warning {{comparison of integers of different signs}} (a < (unsigned int) b) + (a < (unsigned short) b) + @@ -31,8 +31,8 @@ int test0(long a, unsigned long b) { ((signed char) a < b) + // expected-warning {{comparison of integers of different signs}} ((long) a < (unsigned long) b) + // expected-warning {{comparison of integers of different signs}} ((int) a < (unsigned int) b) + // expected-warning {{comparison of integers of different signs}} - ((short) a < (unsigned short) b) + // expected-warning {{comparison of integers of different signs}} - ((signed char) a < (unsigned char) b) + // expected-warning {{comparison of integers of different signs}} + ((short) a < (unsigned short) b) + + ((signed char) a < (unsigned char) b) + // (A,b) (A == (unsigned long) b) + @@ -83,8 +83,8 @@ int test0(long a, unsigned long b) { ((signed char) a < B) + ((long) a < (unsigned long) B) + // expected-warning {{comparison of integers of different signs}} ((int) a < (unsigned int) B) + // expected-warning {{comparison of integers of different signs}} - ((short) a < (unsigned short) B) + // expected-warning {{comparison of integers of different signs}} - ((signed char) a < (unsigned char) B) + // expected-warning {{comparison of integers of different signs}} + ((short) a < (unsigned short) B) + + ((signed char) a < (unsigned char) B) + // (C,b) (C == (unsigned long) b) + @@ -135,8 +135,8 @@ int test0(long a, unsigned long b) { ((signed char) a < C) + ((long) a < (unsigned long) C) + // expected-warning {{comparison of integers of different signs}} ((int) a < (unsigned int) C) + // expected-warning {{comparison of integers of different signs}} - ((short) a < (unsigned short) C) + // expected-warning {{comparison of integers of different signs}} - ((signed char) a < (unsigned char) C) + // expected-warning {{comparison of integers of different signs}} + ((short) a < (unsigned short) C) + + ((signed char) a < (unsigned char) C) + // (0x80000,b) (0x80000 == (unsigned long) b) + @@ -187,8 +187,8 @@ int test0(long a, unsigned long b) { ((signed char) a < 0x80000) + ((long) a < (unsigned long) 0x80000) + // expected-warning {{comparison of integers of different signs}} ((int) a < (unsigned int) 0x80000) + // expected-warning {{comparison of integers of different signs}} - ((short) a < (unsigned short) 0x80000) + // expected-warning {{comparison of integers of different signs}} - ((signed char) a < (unsigned char) 0x80000) + // expected-warning {{comparison of integers of different signs}} + ((short) a < (unsigned short) 0x80000) + + ((signed char) a < (unsigned char) 0x80000) + 10 ; diff --git a/test/SemaCXX/conditional-expr.cpp b/test/SemaCXX/conditional-expr.cpp index a812a5920d..f1fe8ba79b 100644 --- a/test/SemaCXX/conditional-expr.cpp +++ b/test/SemaCXX/conditional-expr.cpp @@ -238,3 +238,20 @@ namespace PR6757 { (void)(true ? Bar() : Foo3()); // expected-error{{no viable constructor copying temporary}} } } + +// Reduced from selfhost. +namespace test1 { + struct A { + enum Foo { + fa, fb, fc, fd, fe, ff + }; + + Foo x(); + }; + + void foo(int); + + void test(A *a) { + foo(a ? a->x() : 0); + } +} |