31 lines · cpp
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=3// RUN: %clang_cc1 -std=c++14 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors -DNOEXCEPT=noexcept -DBAD_ALLOC=4// RUN: %clang_cc1 -std=c++17 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors -DNOEXCEPT=noexcept -DBAD_ALLOC=5// RUN: %clang_cc1 -std=c++20 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors -DNOEXCEPT=noexcept -DBAD_ALLOC=6// RUN: %clang_cc1 -std=c++23 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors -DNOEXCEPT=noexcept -DBAD_ALLOC=7// RUN: %clang_cc1 -std=c++2c %s -verify -fexceptions -fcxx-exceptions -pedantic-errors -DNOEXCEPT=noexcept -DBAD_ALLOC=8 9// cwg412: 3.410// lwg404: yes11// lwg2340: yes12 13// FIXME: __SIZE_TYPE__ expands to 'long long' on some targets.14__extension__ typedef __SIZE_TYPE__ size_t;15namespace std { struct bad_alloc {}; }16 17inline void* operator new(size_t) BAD_ALLOC;18// expected-error@-1 {{replacement function 'operator new' cannot be declared 'inline'}}19inline void* operator new[](size_t) BAD_ALLOC;20// expected-error@-1 {{replacement function 'operator new[]' cannot be declared 'inline'}}21inline void operator delete(void*) NOEXCEPT;22// expected-error@-1 {{replacement function 'operator delete' cannot be declared 'inline'}}23inline void operator delete[](void*) NOEXCEPT;24// expected-error@-1 {{replacement function 'operator delete[]' cannot be declared 'inline'}}25#ifdef __cpp_sized_deallocation26inline void operator delete(void*, size_t) NOEXCEPT;27// expected-error@-1 {{replacement function 'operator delete' cannot be declared 'inline'}}28inline void operator delete[](void*, size_t) NOEXCEPT;29// expected-error@-1 {{replacement function 'operator delete[]' cannot be declared 'inline'}}30#endif31