diff options
Diffstat (limited to 'clang/test')
| -rw-r--r-- | clang/test/CodeGen/complex.c | 16 | ||||
| -rw-r--r-- | clang/test/SemaObjC/format-strings-objc.m | 2 |
2 files changed, 17 insertions, 1 deletions
diff --git a/clang/test/CodeGen/complex.c b/clang/test/CodeGen/complex.c index 206db253caa..1c0e7cb2ee9 100644 --- a/clang/test/CodeGen/complex.c +++ b/clang/test/CodeGen/complex.c @@ -98,3 +98,19 @@ void t8() { const _Complex double test9const = 0; _Complex double test9func() { return test9const; } + +// D6217 +void t91() { + // Check for proper type promotion of conditional expression + char c[(int)(sizeof(typeof((0 ? 2.0f : (_Complex double) 2.0f))) - sizeof(_Complex double))]; + // Check for proper codegen + (0 ? 2.0f : (_Complex double) 2.0f); +} + +void t92() { + // Check for proper type promotion of conditional expression + char c[(int)(sizeof(typeof((0 ? (_Complex double) 2.0f : 2.0f))) - sizeof(_Complex double))]; + // Check for proper codegen + (0 ? (_Complex double) 2.0f : 2.0f); +} + diff --git a/clang/test/SemaObjC/format-strings-objc.m b/clang/test/SemaObjC/format-strings-objc.m index 49567a710c3..f4c528cc7ac 100644 --- a/clang/test/SemaObjC/format-strings-objc.m +++ b/clang/test/SemaObjC/format-strings-objc.m @@ -243,7 +243,7 @@ void testByValueObjectInFormat(Foo *obj) { // <rdar://problem/13557053> void testTypeOf(NSInteger dW, NSInteger dH) { - NSLog(@"dW %d dH %d",({ __typeof__(dW) __a = (dW); __a < 0 ? -__a : __a; }),({ __typeof__(dH) __a = (dH); __a < 0 ? -__a : __a; })); // expected-warning 2 {{values of type 'NSInteger' should not be used as format arguments; add an explicit cast to 'long' instead}} + NSLog(@"dW %d dH %d",({ __typeof__(dW) __a = (dW); __a < 0 ? -__a : __a; }),({ __typeof__(dH) __a = (dH); __a < 0 ? -__a : __a; })); // expected-warning 2 {{format specifies type 'int' but the argument has type 'long'}} } void testUnicode() { |

