dr412.cpp 1.3 KB

123456789101112131415161718192021
  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++1z %s -verify -fexceptions -fcxx-exceptions -pedantic-errors -DNOEXCEPT=noexcept -DBAD_ALLOC=
  5. // dr412: yes
  6. // lwg404: yes
  7. // lwg2340: yes
  8. // FIXME: __SIZE_TYPE__ expands to 'long long' on some targets.
  9. __extension__ typedef __SIZE_TYPE__ size_t;
  10. namespace std { struct bad_alloc {}; }
  11. inline void* operator new(size_t) BAD_ALLOC; // expected-error {{cannot be declared 'inline'}}
  12. inline void* operator new[](size_t) BAD_ALLOC; // expected-error {{cannot be declared 'inline'}}
  13. inline void operator delete(void*) NOEXCEPT; // expected-error {{cannot be declared 'inline'}}
  14. inline void operator delete[](void*) NOEXCEPT; // expected-error {{cannot be declared 'inline'}}
  15. #ifdef __cpp_sized_deallocation
  16. inline void operator delete(void*, size_t) NOEXCEPT; // expected-error {{cannot be declared 'inline'}}
  17. inline void operator delete[](void*, size_t) NOEXCEPT; // expected-error {{cannot be declared 'inline'}}
  18. #endif