From f15f5d3e9fd9db78697c46f216786ac4bb9cdd5b Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Mon, 16 Feb 2009 19:28:42 +0000 Subject: 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 . llvm-svn: 64653 --- clang/lib/Sema/SemaExpr.cpp | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) (limited to 'clang/lib/Sema/SemaExpr.cpp') 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). -- cgit v1.2.3