[cfe-commits] r79781 - in /cfe/trunk: lib/Sema/SemaExpr.cpp test/SemaObjC/conditional-expr-5.m
Fariborz Jahanian
fjahanian at apple.com
Sat Aug 22 15:27:17 PDT 2009
Author: fjahanian
Date: Sat Aug 22 17:27:17 2009
New Revision: 79781
URL: http://llvm.org/viewvc/llvm-project?rev=79781&view=rev
Log:
Type of a ?: expression whose either expression is a built-in 'id'
type is 'id' type.
Added:
cfe/trunk/test/SemaObjC/conditional-expr-5.m
Modified:
cfe/trunk/lib/Sema/SemaExpr.cpp
Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=79781&r1=79780&r2=79781&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Sat Aug 22 17:27:17 2009
@@ -3213,9 +3213,9 @@
// FIXME: Consider unifying with 'areComparableObjCPointerTypes'.
// It could return the composite type.
if (Context.canAssignObjCInterfaces(LHSOPT, RHSOPT)) {
- compositeType = LHSTy;
+ compositeType = RHSOPT->isObjCBuiltinType() ? RHSTy : LHSTy;
} else if (Context.canAssignObjCInterfaces(RHSOPT, LHSOPT)) {
- compositeType = RHSTy;
+ compositeType = LHSOPT->isObjCBuiltinType() ? LHSTy : RHSTy;
} else if ((LHSTy->isObjCQualifiedIdType() ||
RHSTy->isObjCQualifiedIdType()) &&
Context.ObjCQualifiedIdTypesAreCompatible(LHSTy, RHSTy, true)) {
Added: cfe/trunk/test/SemaObjC/conditional-expr-5.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/conditional-expr-5.m?rev=79781&view=auto
==============================================================================
--- cfe/trunk/test/SemaObjC/conditional-expr-5.m (added)
+++ cfe/trunk/test/SemaObjC/conditional-expr-5.m Sat Aug 22 17:27:17 2009
@@ -0,0 +1,27 @@
+// RUN: clang-cc -fsyntax-only -verify %s
+
+ at interface PBXBuildSettingsDictionary
+{
+ int i;
+}
+ at end
+
+ at interface XCConditionalBuildSettingsDictionary : PBXBuildSettingsDictionary
+{
+}
+ at end
+
+ at implementation PBXBuildSettingsDictionary
+
+- (XCConditionalBuildSettingsDictionary *)conditionalDictionaryForConditionSet
+{
+ return i ? self : (id)0;
+}
+
+- (XCConditionalBuildSettingsDictionary *)conditionalDictionaryForConditionSet2
+{
+ return i ? (id)0 : self;
+}
+ at end
+
+
More information about the cfe-commits
mailing list