From d0d4599d8ff308ac34db9e38c578f5b8d32afa7e Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Wed, 29 Apr 2009 05:48:32 +0000 Subject: [PATCH] fix PR4021, array and functions decay in the receiver position of an objc message send. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70373 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Sema/SemaExprObjC.cpp | 6 +++++- test/SemaObjC/message.m | 12 +++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/lib/Sema/SemaExprObjC.cpp b/lib/Sema/SemaExprObjC.cpp index f2cd00195f..a463ab8f83 100644 --- a/lib/Sema/SemaExprObjC.cpp +++ b/lib/Sema/SemaExprObjC.cpp @@ -461,8 +461,12 @@ Sema::ExprResult Sema::ActOnInstanceMessage(ExprTy *receiver, Selector Sel, Expr **ArgExprs = reinterpret_cast(Args); Expr *RExpr = static_cast(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(); diff --git a/test/SemaObjC/message.m b/test/SemaObjC/message.m index 94db014826..7b6a4ee3f7 100644 --- a/test/SemaObjC/message.m +++ b/test/SemaObjC/message.m @@ -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]; +} -- 2.40.0