Richard Smith | ba41a73 | 2014-03-17 08:20:10 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -std=c++98 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors -DNOEXCEPT="throw()" -DBAD_ALLOC="throw(std::bad_alloc)" |
| 2 | // RUN: %clang_cc1 -std=c++11 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors -DNOEXCEPT=noexcept -DBAD_ALLOC= |
Richard Smith | 09c0778 | 2014-09-28 21:56:04 +0000 | [diff] [blame] | 3 | // RUN: %clang_cc1 -std=c++14 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors -DNOEXCEPT=noexcept -DBAD_ALLOC= |
| 4 | // RUN: %clang_cc1 -std=c++1z %s -verify -fexceptions -fcxx-exceptions -pedantic-errors -DNOEXCEPT=noexcept -DBAD_ALLOC= |
Richard Smith | ba41a73 | 2014-03-17 08:20:10 +0000 | [diff] [blame] | 5 | |
| 6 | // dr412: yes |
| 7 | // lwg404: yes |
| 8 | // lwg2340: yes |
| 9 | |
Richard Smith | 6a70c64 | 2014-03-18 00:30:09 +0000 | [diff] [blame] | 10 | // FIXME: __SIZE_TYPE__ expands to 'long long' on some targets. |
| 11 | __extension__ typedef __SIZE_TYPE__ size_t; |
Richard Smith | ba41a73 | 2014-03-17 08:20:10 +0000 | [diff] [blame] | 12 | namespace std { struct bad_alloc {}; } |
Richard Smith | 6504597 | 2014-03-17 16:53:13 +0000 | [diff] [blame] | 13 | |
Richard Smith | ba41a73 | 2014-03-17 08:20:10 +0000 | [diff] [blame] | 14 | inline void* operator new(size_t) BAD_ALLOC; // expected-error {{cannot be declared 'inline'}} |
| 15 | inline void* operator new[](size_t) BAD_ALLOC; // expected-error {{cannot be declared 'inline'}} |
| 16 | inline void operator delete(void*) NOEXCEPT; // expected-error {{cannot be declared 'inline'}} |
| 17 | inline void operator delete[](void*) NOEXCEPT; // expected-error {{cannot be declared 'inline'}} |
Reid Kleckner | 7ffc3fb | 2015-03-20 00:31:07 +0000 | [diff] [blame] | 18 | #ifdef __cpp_sized_deallocation |
Richard Smith | ba41a73 | 2014-03-17 08:20:10 +0000 | [diff] [blame] | 19 | inline void operator delete(void*, size_t) NOEXCEPT; // expected-error {{cannot be declared 'inline'}} |
| 20 | inline void operator delete[](void*, size_t) NOEXCEPT; // expected-error {{cannot be declared 'inline'}} |
| 21 | #endif |