diff options
author | redi <redi@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-05-13 17:22:08 +0000 |
---|---|---|
committer | redi <redi@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-05-13 17:22:08 +0000 |
commit | b49122a5bf322806a59668d1166c5a4bf4d353ed (patch) | |
tree | 28ad5ef3ed4989d00d219267165efbbd8fdf08f6 /libstdc++-v3/testsuite/30_threads | |
parent | b061dab231b806bfa80134a11b0a55524ddcdcef (diff) | |
download | gcc-b49122a5bf322806a59668d1166c5a4bf4d353ed.tar.gz |
PR libstdc++/60497
* include/debug/array (get): Qualify call to other get overload.
* include/profile/array (get): Likewise.
* include/std/array (get): Likewise.
* include/std/functional (_Mu, _Bind, _Bind_result): Qualify std::get.
* include/std/mutex (unique_lock, call_once): Use __addressof.
(__unlock_impl): Remove unused template.
(__try_to_lock): Declare inline.
(__try_lock_impl::__do_try_lock): Qualify function calls.
(lock): Avoid narrowing conversion.
* testsuite/20_util/bind/60497.cc: New.
* testsuite/23_containers/array/element_access/60497.cc: New.
* testsuite/30_threads/call_once/60497.cc: New.
* testsuite/30_threads/unique_lock/cons/60497.cc: New.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@210388 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/testsuite/30_threads')
-rw-r--r-- | libstdc++-v3/testsuite/30_threads/call_once/60497.cc | 41 | ||||
-rw-r--r-- | libstdc++-v3/testsuite/30_threads/unique_lock/cons/60497.cc | 49 |
2 files changed, 90 insertions, 0 deletions
diff --git a/libstdc++-v3/testsuite/30_threads/call_once/60497.cc b/libstdc++-v3/testsuite/30_threads/call_once/60497.cc new file mode 100644 index 00000000000..76cc710f357 --- /dev/null +++ b/libstdc++-v3/testsuite/30_threads/call_once/60497.cc @@ -0,0 +1,41 @@ +// { dg-do compile } +// { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } +// { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-require-cstdint "" } +// { dg-require-gthreads "" } + +// Copyright (C) 2014 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// <http://www.gnu.org/licenses/>. + +// libstdc++/60497 + +#include <mutex> +#include <memory> + +struct A; +template<typename T> struct B { T t; }; + +using UP = std::unique_ptr<B<A>>; + +void f(UP&) { } + +void g(UP& p) +{ + std::once_flag o; + std::call_once(o, f, std::ref(p)); +} diff --git a/libstdc++-v3/testsuite/30_threads/unique_lock/cons/60497.cc b/libstdc++-v3/testsuite/30_threads/unique_lock/cons/60497.cc new file mode 100644 index 00000000000..19be845fd94 --- /dev/null +++ b/libstdc++-v3/testsuite/30_threads/unique_lock/cons/60497.cc @@ -0,0 +1,49 @@ +// { dg-do compile } +// { dg-options " -std=gnu++11 " } + +// Copyright (C) 2014 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// <http://www.gnu.org/licenses/>. + +// libstdc++/60497 + +#include <mutex> +#include <memory> + +struct A; +template<typename T> struct B { T t; }; + +template<typename Dummy> +struct Lockable +{ + void lock(); + void unlock(); + bool try_lock(); +}; + +using test_type = Lockable<std::unique_ptr<B<A>>>; + +void test01() +{ + test_type l; + std::unique_lock<test_type> ul(l); +} + +void test02() +{ + test_type l1, l2, l3; + std::lock(l1, l2, l3); +} |