diff options
| author | Douglas Gregor <dgregor@apple.com> | 2009-02-16 19:28:42 +0000 |
|---|---|---|
| committer | Douglas Gregor <dgregor@apple.com> | 2009-02-16 19:28:42 +0000 |
| commit | f15f5d3e9fd9db78697c46f216786ac4bb9cdd5b (patch) | |
| tree | 978f24d2cf9c36792eb346fe8e98cb1ae9825d68 | |
| parent | 1598a3a1a919a64f4adb95f114c21a00f55efcb7 (diff) | |
| download | bcm5719-llvm-f15f5d3e9fd9db78697c46f216786ac4bb9cdd5b.tar.gz bcm5719-llvm-f15f5d3e9fd9db78697c46f216786ac4bb9cdd5b.zip | |
When inside an Objective-C++ method, name lookup should look into the
interface for ivars before assuming that this is an unresolved
function name.
Fixes <rdar://problem/6590445>.
llvm-svn: 64653
| -rw-r--r-- | clang/lib/Sema/SemaExpr.cpp | 29 | ||||
| -rw-r--r-- | clang/test/SemaObjCXX/blocks.mm | 20 |
2 files changed, 35 insertions, 14 deletions
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index 07079dbb7da..553c29e8972 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -565,20 +565,6 @@ Sema::ActOnDeclarationNameExpr(Scope *S, SourceLocation Loc, LookupResult Lookup = LookupParsedName(S, SS, Name, LookupOrdinaryName, false, true, Loc); - if (getLangOptions().CPlusPlus && (!SS || !SS->isSet()) && - HasTrailingLParen && Lookup.getKind() == LookupResult::NotFound) { - // We've seen something of the form - // - // identifier( - // - // and we did not find any entity by the name - // "identifier". However, this identifier is still subject to - // argument-dependent lookup, so keep track of the name. - return Owned(new (Context) UnresolvedFunctionNameExpr(Name, - Context.OverloadTy, - Loc)); - } - NamedDecl *D = 0; if (Lookup.isAmbiguous()) { DiagnoseAmbiguousLookup(Lookup, Name, Loc, @@ -621,6 +607,21 @@ Sema::ActOnDeclarationNameExpr(Scope *S, SourceLocation Loc, return Owned(new (Context) ObjCSuperExpr(Loc, T)); } } + + if (getLangOptions().CPlusPlus && (!SS || !SS->isSet()) && + HasTrailingLParen && D == 0) { + // We've seen something of the form + // + // identifier( + // + // and we did not find any entity by the name + // "identifier". However, this identifier is still subject to + // argument-dependent lookup, so keep track of the name. + return Owned(new (Context) UnresolvedFunctionNameExpr(Name, + Context.OverloadTy, + Loc)); + } + if (D == 0) { // Otherwise, this could be an implicitly declared function reference (legal // in C90, extension in C99). diff --git a/clang/test/SemaObjCXX/blocks.mm b/clang/test/SemaObjCXX/blocks.mm index a7920069228..34f75a023d3 100644 --- a/clang/test/SemaObjCXX/blocks.mm +++ b/clang/test/SemaObjCXX/blocks.mm @@ -24,3 +24,23 @@ void foo4(id (^objectCreationBlock)(int)) { void foo5(id (^x)(int)) { if (x) { } } + +// <rdar://problem/6590445> +@interface Foo { + @private + void (^_block)(void); +} +- (void)bar; +@end + +namespace N { + class X { }; + void foo(X); +} + +@implementation Foo +- (void)bar { + _block(); + foo(N::X()); // okay +} +@end |

