Author: lattner
Date: Wed Apr 29 00:48:32 2009
New Revision: 70373

URL: http://llvm.org/viewvc/llvm-project?rev=70373&view=rev
Log:
fix PR4021, array and functions decay in the receiver position of an objc 
message send.

Modified:
    cfe/trunk/lib/Sema/SemaExprObjC.cpp
    cfe/trunk/test/SemaObjC/message.m

Modified: cfe/trunk/lib/Sema/SemaExprObjC.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprObjC.cpp?rev=70373&r1=70372&r2=70373&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaExprObjC.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExprObjC.cpp Wed Apr 29 00:48:32 2009
@@ -461,8 +461,12 @@
   
   Expr **ArgExprs = reinterpret_cast<Expr **>(Args);
   Expr *RExpr = static_cast<Expr *>(receiver);
+  
+  // If necessary, apply function/array conversion to the receiver.
+  // C99 6.7.5.3p[7,8].
+  DefaultFunctionArrayConversion(RExpr);
+  
   QualType returnType;
-
   QualType ReceiverCType =
     Context.getCanonicalType(RExpr->getType()).getUnqualifiedType();
 

Modified: cfe/trunk/test/SemaObjC/message.m
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/message.m?rev=70373&r1=70372&r2=70373&view=diff

==============================================================================
--- cfe/trunk/test/SemaObjC/message.m (original)
+++ cfe/trunk/test/SemaObjC/message.m Wed Apr 29 00:48:32 2009
@@ -1,5 +1,10 @@
 // RUN: clang-cc -fsyntax-only -verify %s
 
+typedef struct objc_object {
+  Class isa;
+} *id;
+
+
 @interface foo
 - (void)meth;
 @end
@@ -86,5 +91,10 @@
   int b = [S somemsg];  // expected-error {{bad receiver type 'struct S'}}
 }
 
-
+// PR4021
+void foo4() {
+  struct objc_object X[10];
+  
+  [X rect];
+}
 


_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to