]> granicus.if.org Git - clang/commitdiff
Fix a minor typo in the handling of the conditional operator for Objective-C interfac...
authorDouglas Gregor <dgregor@apple.com>
Wed, 26 Nov 2008 06:43:45 +0000 (06:43 +0000)
committerDouglas Gregor <dgregor@apple.com>
Wed, 26 Nov 2008 06:43:45 +0000 (06:43 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60096 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaExpr.cpp
test/SemaObjC/conditional-expr-3.m

index a13bcbab629ceac6034b0269083e8feb6bc40d4b..b22ae7d1f2bd265b55e8567eebb318bf44b2efbc 100644 (file)
@@ -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)) { 
index f5b04339e837a7c7497ba276d81b1c220df9e5fb..eb313df029b7ac1ed0a49ce9264529156209f024 100644 (file)
@@ -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