diff options
author | Douglas Gregor <dgregor@apple.com> | 2008-11-19 21:05:33 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2008-11-19 21:05:33 +0000 |
commit | 91cea0ad1e4cdec5886dfb3cf805bb116fc24e0a (patch) | |
tree | 1bc8d9d38565df505177df2e5bfb35f8137cc7b7 /clang/lib/Sema/SemaExpr.cpp | |
parent | 4fb443f81b02ce067be24e7848b167a86ea234f2 (diff) | |
download | bcm5719-llvm-91cea0ad1e4cdec5886dfb3cf805bb116fc24e0a.tar.gz bcm5719-llvm-91cea0ad1e4cdec5886dfb3cf805bb116fc24e0a.zip |
Support for calling overloaded function call operators (operator())
with function call syntax, e.g.,
Functor f;
f(x, y);
This is the easy part of handling calls to objects of class type
(C++ [over.call.object]). The hard part (coping with conversions from
f to function pointer or reference types) will come later. Nobody uses
that stuff anyway, right? :)
llvm-svn: 59663
Diffstat (limited to 'clang/lib/Sema/SemaExpr.cpp')
-rw-r--r-- | clang/lib/Sema/SemaExpr.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index a780012235a..147b4c8323d 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -1291,8 +1291,8 @@ ActOnCallExpr(ExprTy *fn, SourceLocation LParenLoc, // resolution to pick the function. if (Ovl) { OverloadCandidateSet CandidateSet; - OverloadCandidateSet::iterator Best; AddOverloadCandidates(Ovl, Args, NumArgs, CandidateSet); + OverloadCandidateSet::iterator Best; switch (BestViableFunction(CandidateSet, Best)) { case OR_Success: { @@ -1327,6 +1327,10 @@ ActOnCallExpr(ExprTy *fn, SourceLocation LParenLoc, } } + if (getLangOptions().CPlusPlus && Fn->getType()->isRecordType()) + return BuildCallToObjectOfClassType(Fn, LParenLoc, Args, NumArgs, + CommaLocs, RParenLoc); + // Promote the function operand. UsualUnaryConversions(Fn); |