annotate libstdc++-v3/testsuite/30_threads/unique_lock/cons/60497.cc @ 117:f81c5aa9f14f

fix
author mir3636
date Tue, 28 Nov 2017 21:17:15 +0900
parents 04ced10e8804
children 84e7813d76e9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 // { dg-do compile { target c++11 } }
kono
parents:
diff changeset
2
kono
parents:
diff changeset
3 // Copyright (C) 2014-2017 Free Software Foundation, Inc.
kono
parents:
diff changeset
4 //
kono
parents:
diff changeset
5 // This file is part of the GNU ISO C++ Library. This library is free
kono
parents:
diff changeset
6 // software; you can redistribute it and/or modify it under the
kono
parents:
diff changeset
7 // terms of the GNU General Public License as published by the
kono
parents:
diff changeset
8 // Free Software Foundation; either version 3, or (at your option)
kono
parents:
diff changeset
9 // any later version.
kono
parents:
diff changeset
10
kono
parents:
diff changeset
11 // This library is distributed in the hope that it will be useful,
kono
parents:
diff changeset
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
kono
parents:
diff changeset
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
kono
parents:
diff changeset
14 // GNU General Public License for more details.
kono
parents:
diff changeset
15
kono
parents:
diff changeset
16 // You should have received a copy of the GNU General Public License along
kono
parents:
diff changeset
17 // with this library; see the file COPYING3. If not see
kono
parents:
diff changeset
18 // <http://www.gnu.org/licenses/>.
kono
parents:
diff changeset
19
kono
parents:
diff changeset
20 // libstdc++/60497
kono
parents:
diff changeset
21
kono
parents:
diff changeset
22 #include <mutex>
kono
parents:
diff changeset
23 #include <memory>
kono
parents:
diff changeset
24
kono
parents:
diff changeset
25 struct A;
kono
parents:
diff changeset
26 template<typename T> struct B { T t; };
kono
parents:
diff changeset
27
kono
parents:
diff changeset
28 template<typename Dummy>
kono
parents:
diff changeset
29 struct Lockable
kono
parents:
diff changeset
30 {
kono
parents:
diff changeset
31 void lock();
kono
parents:
diff changeset
32 void unlock();
kono
parents:
diff changeset
33 bool try_lock();
kono
parents:
diff changeset
34 };
kono
parents:
diff changeset
35
kono
parents:
diff changeset
36 using test_type = Lockable<std::unique_ptr<B<A>>>;
kono
parents:
diff changeset
37
kono
parents:
diff changeset
38 void test01()
kono
parents:
diff changeset
39 {
kono
parents:
diff changeset
40 test_type l;
kono
parents:
diff changeset
41 std::unique_lock<test_type> ul(l);
kono
parents:
diff changeset
42 }
kono
parents:
diff changeset
43
kono
parents:
diff changeset
44 void test02()
kono
parents:
diff changeset
45 {
kono
parents:
diff changeset
46 test_type l1, l2, l3;
kono
parents:
diff changeset
47 std::lock(l1, l2, l3);
kono
parents:
diff changeset
48 }