Skip to content

cpp11: clang doesn't allow mutex_t to be used with constexpr #4583

@thomaseichinger

Description

@thomaseichinger

All cpp11-* tests fail for OS X with clang with the following errors.

In file included from RIOT/tests/cpp11_condition_variable/main.cpp:26:
RIOT/sys/cpp11-compat/include/riot/mutex.hpp:47:45: error: suggest braces around initialization of subobject [-Werror,-Wmissing-braces]
  inline constexpr mutex() noexcept : m_mtx{0, PRIORITY_QUEUE_INIT} {}
                                            ^
                                            {}
RIOT/sys/cpp11-compat/include/riot/mutex.hpp:47:20: error: constexpr constructor never produces a constant expression
      [-Winvalid-constexpr]
  inline constexpr mutex() noexcept : m_mtx{0, PRIORITY_QUEUE_INIT} {}
                   ^
RIOT/sys/cpp11-compat/include/riot/mutex.hpp:47:44: note: non-literal type 'mutex_t' cannot be used in a constant expression
  inline constexpr mutex() noexcept : m_mtx{0, PRIORITY_QUEUE_INIT} {}

Compiled with

 % clang -v
Apple LLVM version 7.0.0 (clang-700.0.72)
Target: x86_64-apple-darwin15.2.0
Thread model: posix

Metadata

Metadata

Assignees

Labels

Area: C++Area: C++ wrapperOS: Mac OS XHost OS: This PR/issue concerns usage of RIOT with Mac OS X as a host system

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions