]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/testsuite/g++.dg/init/new25.C
* doc/invoke.texi: Document -std=c++17 and -std=gnu++17 and document
[thirdparty/gcc.git] / gcc / testsuite / g++.dg / init / new25.C
CommitLineData
e0b2a9fb 1// PR c++/31988
2#include <new>
3
4class C
5{
6public:
7 void* operator new(std::size_t = 32) throw (std::bad_alloc); // { dg-error "first parameter" }
40e2decb 8 // { dg-error "dynamic exception specification" "" { target c++17 } .-1 }
9 // { dg-warning "deprecated" "" { target { c++11 && { ! c++17 } } } .-2 }
e0b2a9fb 10 void* operator new[](std::size_t = 32) throw (std::bad_alloc); // { dg-error "first parameter" }
40e2decb 11 // { dg-error "dynamic exception specification" "" { target c++17 } .-1 }
12 // { dg-warning "deprecated" "" { target { c++11 && { ! c++17 } } } .-2 }
e0b2a9fb 13 void* operator new(std::size_t = 32, const std::nothrow_t&) throw(); // { dg-error "first parameter" }
14 void* operator new[](std::size_t = 32, const std::nothrow_t&) throw(); // { dg-error "first parameter" }
15};
16
17class D
18{
19public:
20 void* operator new(std::size_t,
21 const std::nothrow_t& = std::nothrow_t()) throw();
22 void* operator new[](std::size_t,
23 const std::nothrow_t& = std::nothrow_t()) throw();
24};
25
26class E
27{
28public:
29 void* operator new(std::size_t = 0,
30 const std::nothrow_t& = std::nothrow_t()) throw(); // { dg-error "first parameter" }
31 void* operator new[](std::size_t = 0,
32 const std::nothrow_t& = std::nothrow_t()) throw(); // { dg-error "first parameter" }
33};