diff options
Diffstat (limited to 'clang')
-rw-r--r-- | clang/lib/CodeGen/CGExprScalar.cpp | 2 | ||||
-rw-r--r-- | clang/test/CodeGen/conditional.c | 12 |
2 files changed, 13 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CGExprScalar.cpp b/clang/lib/CodeGen/CGExprScalar.cpp index 622d2c5317a..ea92828f729 100644 --- a/clang/lib/CodeGen/CGExprScalar.cpp +++ b/clang/lib/CodeGen/CGExprScalar.cpp @@ -1074,7 +1074,7 @@ VisitConditionalOperator(const ConditionalOperator *E) { CGF.EmitBlock(ContBlock); - if (!LHS) { + if (!LHS || !RHS) { assert(E->getType()->isVoidType() && "Non-void value should have a value"); return 0; } diff --git a/clang/test/CodeGen/conditional.c b/clang/test/CodeGen/conditional.c index d3e5c0b9384..29ad7867938 100644 --- a/clang/test/CodeGen/conditional.c +++ b/clang/test/CodeGen/conditional.c @@ -30,3 +30,15 @@ void test6(); void test7(int); void* test8() {return 1 ? test6 : test7;} + +void _efree(void *ptr); + +void _php_stream_free3() +{ + (1 ? free(0) : _efree(0)); +} + +void _php_stream_free4() +{ + 1 ? _efree(0) : free(0); +} |