]> granicus.if.org Git - clang/commitdiff
fix PR4021, array and functions decay in the receiver position of an objc message...
authorChris Lattner <sabre@nondot.org>
Wed, 29 Apr 2009 05:48:32 +0000 (05:48 +0000)
committerChris Lattner <sabre@nondot.org>
Wed, 29 Apr 2009 05:48:32 +0000 (05:48 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70373 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaExprObjC.cpp
test/SemaObjC/message.m

index f2cd00195fab1ec9daa3091af135575532d32f85..a463ab8f83a3005781b2447e387d379ef0f350bd 100644 (file)
@@ -461,8 +461,12 @@ Sema::ExprResult Sema::ActOnInstanceMessage(ExprTy *receiver, Selector Sel,
   
   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();
 
index 94db01482613aa4d125da3117fbbb4518af0745b..7b6a4ee3f796d007ad1d191211af510321cc8b72 100644 (file)
@@ -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 test5(int X) {
   int b = [S somemsg];  // expected-error {{bad receiver type 'struct S'}}
 }
 
-
+// PR4021
+void foo4() {
+  struct objc_object X[10];
+  
+  [X rect];
+}