diff options
author | Steve Naroff <snaroff@apple.com> | 2008-05-31 02:19:15 +0000 |
---|---|---|
committer | Steve Naroff <snaroff@apple.com> | 2008-05-31 02:19:15 +0000 |
commit | a326bae77ade88390ba6acd40eeb1f421eafa73a (patch) | |
tree | 4c27abae4e0553b1c81dddbaa52a4358e24af665 | |
parent | bd3390c73a17a99f8951b833b3b72b2228997380 (diff) | |
download | bcm5719-llvm-a326bae77ade88390ba6acd40eeb1f421eafa73a.tar.gz bcm5719-llvm-a326bae77ade88390ba6acd40eeb1f421eafa73a.zip |
Fix <rdar://problem/5965704> clang: bad receiver type 'id const'
llvm-svn: 51809
-rw-r--r-- | clang/lib/Sema/SemaExprObjC.cpp | 5 | ||||
-rw-r--r-- | clang/test/Sema/const-id.m | 8 |
2 files changed, 11 insertions, 2 deletions
diff --git a/clang/lib/Sema/SemaExprObjC.cpp b/clang/lib/Sema/SemaExprObjC.cpp index c55c05893f5..dd90b9ca19d 100644 --- a/clang/lib/Sema/SemaExprObjC.cpp +++ b/clang/lib/Sema/SemaExprObjC.cpp @@ -199,11 +199,12 @@ Sema::ExprResult Sema::ActOnInstanceMessage( Expr **ArgExprs = reinterpret_cast<Expr **>(Args); Expr *RExpr = static_cast<Expr *>(receiver); - QualType receiverType = RExpr->getType().getCanonicalType(); + QualType receiverType; QualType returnType; ObjCMethodDecl *Method = 0; + + receiverType = RExpr->getType().getCanonicalType().getUnqualifiedType(); - // FIXME: This code is not stripping off type qualifiers! Should it? if (receiverType == Context.getObjCIdType().getCanonicalType() || receiverType == Context.getObjCClassType().getCanonicalType()) { Method = InstanceMethodPool[Sel].Method; diff --git a/clang/test/Sema/const-id.m b/clang/test/Sema/const-id.m new file mode 100644 index 00000000000..9087e4ce7df --- /dev/null +++ b/clang/test/Sema/const-id.m @@ -0,0 +1,8 @@ +// RUN: clang %s -verify -fsyntax-only + +int main() { + const id foo; + [foo bar]; // expected-warning {{method '-bar' not found (return type defaults to 'id')}} + return 0; +} + |