diff options
author | Anders Carlsson <andersca@mac.com> | 2009-11-15 18:59:32 +0000 |
---|---|---|
committer | Anders Carlsson <andersca@mac.com> | 2009-11-15 18:59:32 +0000 |
commit | 67bf2e7706b82d5debd5c189d9454130df7db0d8 (patch) | |
tree | 8d13b3e7496304e3158723713f2d585a8a41c0d4 /lib/Sema/SemaDecl.cpp | |
parent | 78f74551815f8b23bc0f8acf87640e963fad07d4 (diff) |
allocation functions are always static.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@88858 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDecl.cpp')
-rw-r--r-- | lib/Sema/SemaDecl.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index 34e9acb9ad..82e9acd91a 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -2612,10 +2612,19 @@ Sema::ActOnFunctionDeclarator(Scope* S, Declarator& D, DeclContext* DC, return 0; } + bool isStatic = SC == FunctionDecl::Static; + + // [class.free]p1: + // Any allocation function for a class T is a static member + // (even if not explicitly declared static). + if (Name.getCXXOverloadedOperator() == OO_New || + Name.getCXXOverloadedOperator() == OO_Array_New) + isStatic = true; + // This is a C++ method declaration. NewFD = CXXMethodDecl::Create(Context, cast<CXXRecordDecl>(DC), D.getIdentifierLoc(), Name, R, DInfo, - (SC == FunctionDecl::Static), isInline); + isStatic, isInline); isVirtualOkay = (SC != FunctionDecl::Static); } else { |