summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDecl.cpp
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2009-11-15 19:08:46 +0000
committerAnders Carlsson <andersca@mac.com>2009-11-15 19:08:46 +0000
commit7ade203c6c77cb1c90bee1fa1419bec37fd0ec09 (patch)
treef5bcad157be50f9d107381efd152a857a6aac041 /clang/lib/Sema/SemaDecl.cpp
parent623e9798df680a1bc1988c043785466c9269fa08 (diff)
downloadbcm5719-llvm-7ade203c6c77cb1c90bee1fa1419bec37fd0ec09.tar.gz
bcm5719-llvm-7ade203c6c77cb1c90bee1fa1419bec37fd0ec09.zip
Deallocation functions must also be static.
llvm-svn: 88859
Diffstat (limited to 'clang/lib/Sema/SemaDecl.cpp')
-rw-r--r--clang/lib/Sema/SemaDecl.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 82e9acd91a9..d3257c17a40 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -2620,13 +2620,19 @@ Sema::ActOnFunctionDeclarator(Scope* S, Declarator& D, DeclContext* DC,
if (Name.getCXXOverloadedOperator() == OO_New ||
Name.getCXXOverloadedOperator() == OO_Array_New)
isStatic = true;
+
+ // [class.free]p6 Any deallocation function for a class X is a static member
+ // (even if not explicitly declared static).
+ if (Name.getCXXOverloadedOperator() == OO_Delete ||
+ Name.getCXXOverloadedOperator() == OO_Array_Delete)
+ isStatic = true;
// This is a C++ method declaration.
NewFD = CXXMethodDecl::Create(Context, cast<CXXRecordDecl>(DC),
D.getIdentifierLoc(), Name, R, DInfo,
isStatic, isInline);
- isVirtualOkay = (SC != FunctionDecl::Static);
+ isVirtualOkay = !isStatic;
} else {
// Determine whether the function was written with a
// prototype. This true when:
OpenPOWER on IntegriCloud