diff options
Diffstat (limited to 'gcc/testsuite/g++.dg/init/new25.C')
-rw-r--r-- | gcc/testsuite/g++.dg/init/new25.C | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/init/new25.C b/gcc/testsuite/g++.dg/init/new25.C new file mode 100644 index 000000000..2d447f8f2 --- /dev/null +++ b/gcc/testsuite/g++.dg/init/new25.C @@ -0,0 +1,29 @@ +// PR c++/31988 +#include <new> + +class C +{ +public: + void* operator new(std::size_t = 32) throw (std::bad_alloc); // { dg-error "first parameter" } + void* operator new[](std::size_t = 32) throw (std::bad_alloc); // { dg-error "first parameter" } + void* operator new(std::size_t = 32, const std::nothrow_t&) throw(); // { dg-error "first parameter" } + void* operator new[](std::size_t = 32, const std::nothrow_t&) throw(); // { dg-error "first parameter" } +}; + +class D +{ +public: + void* operator new(std::size_t, + const std::nothrow_t& = std::nothrow_t()) throw(); + void* operator new[](std::size_t, + const std::nothrow_t& = std::nothrow_t()) throw(); +}; + +class E +{ +public: + void* operator new(std::size_t = 0, + const std::nothrow_t& = std::nothrow_t()) throw(); // { dg-error "first parameter" } + void* operator new[](std::size_t = 0, + const std::nothrow_t& = std::nothrow_t()) throw(); // { dg-error "first parameter" } +}; |