diff options
author | Steve Naroff <snaroff@apple.com> | 2009-04-08 17:05:15 +0000 |
---|---|---|
committer | Steve Naroff <snaroff@apple.com> | 2009-04-08 17:05:15 +0000 |
commit | ea4c780da19e11edc9d13a09b51a6eb6b7446e11 (patch) | |
tree | 1ef7aee41579eec9d33ae052c75bafa1ce918739 /clang/test/Sema/conditional-expr.c | |
parent | 3da1d240ffdcbc8729da9b91ac0a2fa1bd310229 (diff) | |
download | llvm-ea4c780da19e11edc9d13a09b51a6eb6b7446e11.zip llvm-ea4c780da19e11edc9d13a09b51a6eb6b7446e11.tar.gz llvm-ea4c780da19e11edc9d13a09b51a6eb6b7446e11.tar.bz2 |
Sema::CheckConditionalOperands(): Soften pointer/integer mismatch from error->warning.
Fixes <rdar://problem/6762239> [sema] gcc incompatibility; error on incompatible operand types in ?:.
llvm-svn: 68617
Diffstat (limited to 'clang/test/Sema/conditional-expr.c')
-rw-r--r-- | clang/test/Sema/conditional-expr.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/clang/test/Sema/conditional-expr.c b/clang/test/Sema/conditional-expr.c index c068113..1f0a9de 100644 --- a/clang/test/Sema/conditional-expr.c +++ b/clang/test/Sema/conditional-expr.c @@ -40,3 +40,12 @@ int Postgresql() { char x; return ((((&x) != ((void *) 0)) ? (*(&x) = ((char) 1)) : (void) ((void *) 0)), (unsigned long) ((void *) 0)); // expected-warning {{C99 forbids conditional expressions with only one void side}} } + +#define nil ((void*) 0) + +extern int f1(void); + +int f0(int a) { + // GCC considers this a warning. + return a ? f1() : nil; // expected-warning {{pointer/integer type mismatch in conditional expression ('int' and 'void *')}} expected-warning {{incompatible pointer to integer conversion returning 'void *', expected 'int'}} +} |