forked from OSchip/llvm-project
[SemaObjC] Fix a crash on an invalid ternary with ARC pointers
FindCompositeObjCPointerType nulls out the subexpressions on error, so bail out instead of trying to deref them.
This commit is contained in:
parent
bcdd4359e1
commit
498c7fa48a
|
@ -6325,6 +6325,8 @@ QualType Sema::CXXCheckConditionalOperands(ExprResult &Cond, ExprResult &LHS,
|
|||
|
||||
// Similarly, attempt to find composite type of two objective-c pointers.
|
||||
Composite = FindCompositeObjCPointerType(LHS, RHS, QuestionLoc);
|
||||
if (LHS.isInvalid() || RHS.isInvalid())
|
||||
return QualType();
|
||||
if (!Composite.isNull())
|
||||
return Composite;
|
||||
|
||||
|
|
|
@ -216,3 +216,10 @@ void ownership_transfer_in_cast(void *vp, Block *pblk) {
|
|||
|
||||
// Make sure we don't crash.
|
||||
void writeback_test(NSString & &) {} // expected-error {{type name declared as a reference to a reference}}
|
||||
|
||||
void test_strong_opaque() {
|
||||
__strong NSString *sptr;
|
||||
void *vptr;
|
||||
|
||||
(void)(0 ? sptr : vptr); // expected-error{{operands to conditional of types 'NSString *' and 'void *' are incompatible in ARC mode}}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue