diff options
author | Anders Carlsson <andersca@mac.com> | 2009-12-11 23:23:22 +0000 |
---|---|---|
committer | Anders Carlsson <andersca@mac.com> | 2009-12-11 23:23:22 +0000 |
commit | 9d59ecb4d2c2e8efdb214589753826b662246d82 (patch) | |
tree | 1bbe77411610065a0e36350c6dbed12653cff374 /test | |
parent | 6fba85dc6509069ff7735283464bd02da2da6eeb (diff) |
Improve diagnostics for malformed delete operator function declarations.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91180 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r-- | test/CXX/basic/basic.stc/basic.stc.dynamic/basic.stc.dynamic.deallocation/p1.cpp | 11 | ||||
-rw-r--r-- | test/CXX/special/class.free/p6.cpp | 2 |
2 files changed, 12 insertions, 1 deletions
diff --git a/test/CXX/basic/basic.stc/basic.stc.dynamic/basic.stc.dynamic.deallocation/p1.cpp b/test/CXX/basic/basic.stc/basic.stc.dynamic/basic.stc.dynamic.deallocation/p1.cpp new file mode 100644 index 0000000000..04af5bc82e --- /dev/null +++ b/test/CXX/basic/basic.stc/basic.stc.dynamic/basic.stc.dynamic.deallocation/p1.cpp @@ -0,0 +1,11 @@ +// RUN: clang-cc -fsyntax-only -verify %s + +struct A { + void operator delete(void*); +}; + +namespace NS { + void operator delete(void *); // expected-error {{'operator delete' cannot be declared inside a namespace}} +} + +static void operator delete(void *); // expected-error {{'operator delete' cannot be declared static in global scope}} diff --git a/test/CXX/special/class.free/p6.cpp b/test/CXX/special/class.free/p6.cpp index 8334817ca2..b082b85d18 100644 --- a/test/CXX/special/class.free/p6.cpp +++ b/test/CXX/special/class.free/p6.cpp @@ -2,7 +2,7 @@ #include <stddef.h> struct A { - void operator delete(size_t) { + void operator delete(void*) { (void)this; // expected-error {{invalid use of 'this' outside of a nonstatic member function}} } void operator delete[](void*) { |