diff options
author | Douglas Gregor <dgregor@apple.com> | 2008-11-06 22:13:31 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2008-11-06 22:13:31 +0000 |
commit | 1cd1b1e987f5e2f060d7972b13d83239b36d77d6 (patch) | |
tree | 2776b50f5ad1ceafd1aae9a31001b6b1a3f9dd5d /lib/Sema/SemaDecl.cpp | |
parent | 5142af38ed0dd2f592cbfa00fa6e2e14dd6cc516 (diff) |
Parsing, ASTs, and semantic analysis for the declaration of overloaded
operators in C++. Overloaded operators can be called directly via
their operator-function-ids, e.g., "operator+(foo, bar)", but we don't
yet implement the semantics of operator overloading to handle, e.g.,
"foo + bar".
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58817 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDecl.cpp')
-rw-r--r-- | lib/Sema/SemaDecl.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index 38a5c3780b..3e4e2c5b2c 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -932,6 +932,11 @@ Sema::ActOnDeclarator(Scope *S, Declarator &D, DeclTy *lastDecl) { else if (CXXDestructorDecl *Destructor = dyn_cast<CXXDestructorDecl>(NewFD)) return ActOnDestructorDeclarator(Destructor); + // Extra checking for C++ overloaded operators (C++ [over.oper]). + if (NewFD->isOverloadedOperator() && + CheckOverloadedOperatorDeclaration(NewFD)) + NewFD->setInvalidDecl(); + // Merge the decl with the existing one if appropriate. Since C functions // are in a flat namespace, make sure we consider decls in outer scopes. if (PrevDecl && |