This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/68739] FAIL: 30_threads/call_once/constexpr.cc (test for excess errors)
- From: "redi at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sat, 18 Feb 2017 15:19:18 +0000
- Subject: [Bug libstdc++/68739] FAIL: 30_threads/call_once/constexpr.cc (test for excess errors)
- Auto-submitted: auto-generated
- References: <bug-68739-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68739
--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
The standard says those types must have a constexpr constructor, but we can't
implement that on all targets:
// Common base class for std::mutex and std::timed_mutex
class __mutex_base
{
protected:
typedef __gthread_mutex_t __native_type;
#ifdef __GTHREAD_MUTEX_INIT
__native_type _M_mutex = __GTHREAD_MUTEX_INIT;
constexpr __mutex_base() noexcept = default;
#else
__native_type _M_mutex;
__mutex_base() noexcept
{
// XXX EAGAIN, ENOMEM, EPERM, EBUSY(may), EINVAL(may)
__GTHREAD_MUTEX_INIT_FUNCTION(&_M_mutex);
}
~__mutex_base() noexcept { __gthread_mutex_destroy(&_M_mutex); }
#endif
...
class mutex : private __mutex_base
{
public:
typedef __native_type* native_handle_type;
#ifdef __GTHREAD_MUTEX_INIT
constexpr
#endif
mutex() noexcept = default;
I think we simply need to disable the tests for targets that don't support
static initializers such as PTHREAD_MUTEX_INITIALIZER.