summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/lib/AST/Decl.cpp2
-rw-r--r--clang/test/SemaCXX/new-delete.cpp3
2 files changed, 4 insertions, 1 deletions
diff --git a/clang/lib/AST/Decl.cpp b/clang/lib/AST/Decl.cpp
index 89470725bb3..7234d4c8327 100644
--- a/clang/lib/AST/Decl.cpp
+++ b/clang/lib/AST/Decl.cpp
@@ -2348,7 +2348,7 @@ bool FunctionDecl::isReplaceableGlobalAllocationFunction() const {
return false;
const FunctionProtoType *FPT = getType()->castAs<FunctionProtoType>();
- if (FPT->getNumParams() > 2 || FPT->isVariadic())
+ if (FPT->getNumParams() == 0 || FPT->getNumParams() > 2 || FPT->isVariadic())
return false;
// If this is a single-parameter function, it must be a replaceable global
diff --git a/clang/test/SemaCXX/new-delete.cpp b/clang/test/SemaCXX/new-delete.cpp
index 175ebe7fcda..cb43458d457 100644
--- a/clang/test/SemaCXX/new-delete.cpp
+++ b/clang/test/SemaCXX/new-delete.cpp
@@ -521,3 +521,6 @@ class DeletingPlaceholder {
namespace PR18544 {
inline void *operator new(size_t); // expected-error {{'operator new' cannot be declared inside a namespace}}
}
+
+// PR19968
+inline void* operator new(); // expected-error {{'operator new' must have at least one parameter}}
OpenPOWER on IntegriCloud