diff options
| author | Richard Smith <richard-llvm@metafoo.co.uk> | 2013-09-29 04:40:38 +0000 |
|---|---|---|
| committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2013-09-29 04:40:38 +0000 |
| commit | 1cdec019e800e3db92602cda07463e7a2cce4d44 (patch) | |
| tree | 92cee9ecde8d5e2ae57774a63483330320a6143e /clang/test/SemaCXX/cxx1y-sized-deallocation.cpp | |
| parent | d75c8ebdd10dfcfd3cc8437ceca0b2a8ca12203e (diff) | |
| download | bcm5719-llvm-1cdec019e800e3db92602cda07463e7a2cce4d44.tar.gz bcm5719-llvm-1cdec019e800e3db92602cda07463e7a2cce4d44.zip | |
Implement C++1y sized deallocation (n3778). This is not enabled by -std=c++1y;
instead, it's enabled by the -cc1 flag -fsized-deallocation, until we sort out
the backward-compatibility issues.
llvm-svn: 191629
Diffstat (limited to 'clang/test/SemaCXX/cxx1y-sized-deallocation.cpp')
| -rw-r--r-- | clang/test/SemaCXX/cxx1y-sized-deallocation.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/cxx1y-sized-deallocation.cpp b/clang/test/SemaCXX/cxx1y-sized-deallocation.cpp new file mode 100644 index 00000000000..81a8eeb6df9 --- /dev/null +++ b/clang/test/SemaCXX/cxx1y-sized-deallocation.cpp @@ -0,0 +1,17 @@ +// RUN: %clang_cc1 -std=c++1y -verify %s -fsized-deallocation -fexceptions -fcxx-exceptions + +using size_t = decltype(sizeof(0)); + +void f(void *p, void *q) { + // OK, implicitly declared. + operator delete(p, 8); + operator delete[](q, 12); + static_assert(noexcept(operator delete(p, 8)), ""); + static_assert(noexcept(operator delete[](q, 12)), ""); +} + +void *operator new(size_t bad, size_t idea); +struct S { S() { throw 0; } }; +void g() { + new (123) S; // expected-error {{'new' expression with placement arguments refers to non-placement 'operator delete'}} +} |

