aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2008-11-26 06:43:45 +0000
committerDouglas Gregor <dgregor@apple.com>2008-11-26 06:43:45 +0000
commit7ffd0defb993f82449afb18bb85a734e4b1bc308 (patch)
treed0224a35b5e974e1ea678f882e4e3bcf177c82f7
parent0a39668d6adf1d709985eef149136a80372f5032 (diff)
Fix a minor typo in the handling of the conditional operator for Objective-C interface pointers
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60096 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Sema/SemaExpr.cpp2
-rw-r--r--test/SemaObjC/conditional-expr-3.m4
2 files changed, 5 insertions, 1 deletions
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp
index a13bcbab62..b22ae7d1f2 100644
--- a/lib/Sema/SemaExpr.cpp
+++ b/lib/Sema/SemaExpr.cpp
@@ -1644,7 +1644,7 @@ inline QualType Sema::CheckConditionalOperands( // C99 6.5.15
Context.canAssignObjCInterfaces(LHSIface, RHSIface)) {
compositeType = lexT;
} else if (LHSIface && RHSIface &&
- Context.canAssignObjCInterfaces(LHSIface, RHSIface)) {
+ Context.canAssignObjCInterfaces(RHSIface, LHSIface)) {
compositeType = rexT;
} else if (Context.isObjCIdType(lhptee) ||
Context.isObjCIdType(rhptee)) {
diff --git a/test/SemaObjC/conditional-expr-3.m b/test/SemaObjC/conditional-expr-3.m
index f5b04339e8..eb313df029 100644
--- a/test/SemaObjC/conditional-expr-3.m
+++ b/test/SemaObjC/conditional-expr-3.m
@@ -61,3 +61,7 @@ void f9(int cond, id<P0,P1> x0, id<P0,P2> x1) {
void f10(int cond, id<P0,P1> x0, id<P0,P2> x1) {
barP2(cond ? x0 : x1);
}
+
+int f11(int cond, A* a, B* b) {
+ return (cond? b : a)->x; // expected-error{{'A' does not have a member named 'x'}}
+} \ No newline at end of file