diff options
author | Eric Fiselier <eric@efcs.ca> | 2017-06-07 20:47:42 +0000 |
---|---|---|
committer | Eric Fiselier <eric@efcs.ca> | 2017-06-07 20:47:42 +0000 |
commit | 8551d0e319300884ac52f74dbff4f00b0f72aae4 (patch) | |
tree | 1f853277407daabd4ea8814ff1aa315d856127e9 /libcxx/test/std/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex | |
parent | a302ae096e1625af814822cbd204590ec4546d97 (diff) | |
download | bcm5719-llvm-8551d0e319300884ac52f74dbff4f00b0f72aae4.tar.gz bcm5719-llvm-8551d0e319300884ac52f74dbff4f00b0f72aae4.zip |
Fix compile error with Bionic's PTHREAD_MUTEX_INITIALIZER
On Bionic PTHREAD_MUTEX_INITIALIZER contains the expression "<enum-type> & <integer-type>",
which causes ADL to perform name lookup for operator&. During this lookup Clang decides
that it requires the default member initializer for std::mutex while defining the DMI
for std::mutex::__m_.
If I'm not mistaken this is caused by the explicit noexcept declaration on the defaulted
constructor.
This patch removes the explicit noexcept and instead allows the compiler to declare
the default constructor implicitly noexcept. It also adds a static_assert to ensure
that happens.
Unfortunatly because it's not easy to change the value of _LIBCPP_MUTEX_INITIALIZER
for a single test there is no good way to test this patch.
The Clang behavior causing the trouble here was introduced in r287713, which first
appears in the 4.0 release.
llvm-svn: 304942
Diffstat (limited to 'libcxx/test/std/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex')
-rw-r--r-- | libcxx/test/std/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.class/default.pass.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/libcxx/test/std/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.class/default.pass.cpp b/libcxx/test/std/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.class/default.pass.cpp index 4de42fbd024..48c3a73a06c 100644 --- a/libcxx/test/std/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.class/default.pass.cpp +++ b/libcxx/test/std/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.class/default.pass.cpp @@ -16,8 +16,10 @@ // mutex(); #include <mutex> +#include <type_traits> int main() { + static_assert(std::is_nothrow_default_constructible<std::mutex>::value, ""); std::mutex m; } |