Mercurial > hg > CbC > CbC_gcc
view gcc/testsuite/g++.dg/torture/pr52918-1.C @ 131:84e7813d76e9
gcc-8.2
author | mir3636 |
---|---|
date | Thu, 25 Oct 2018 07:37:49 +0900 |
parents | 04ced10e8804 |
children |
line wrap: on
line source
// { dg-do compile } typedef __SIZE_TYPE__ size_t; class bad_alloc { }; typedef struct { } __gthread_mutex_t; int __gthread_mutex_unlock (__gthread_mutex_t *__mutex); class __concurrence_unlock_error { }; inline void __throw_concurrence_unlock_error() { throw __concurrence_unlock_error(); } class __mutex { __gthread_mutex_t _M_mutex; public: void unlock() { if (__gthread_mutex_unlock(&_M_mutex) != 0) __throw_concurrence_unlock_error(); } }; class free_list { typedef __mutex __mutex_type; __mutex_type& _M_get_mutex(); void _M_get(size_t __sz) #if __cplusplus <= 201402L throw(bad_alloc) // { dg-warning "deprecated" "" { target { c++11 && { ! c++17 } } } } #endif ; }; void free_list::_M_get(size_t __sz) #if __cplusplus <= 201402L throw(bad_alloc) // { dg-warning "deprecated" "" { target { c++11 && { ! c++17 } } } } #endif { __mutex_type& __bfl_mutex = _M_get_mutex(); __bfl_mutex.unlock(); int __ctr = 2; while (__ctr) { size_t* __ret = 0; --__ctr; try { __ret = (size_t*) (::operator new(__sz + sizeof(size_t))); } catch(const bad_alloc&) { } } }