Debian Codegraph @

libstdc++-v3/testsuite/20_util/tuple/cons/121771.cc

raw
1 // { dg-do compile { target c++17 } }
2
3 // Bug 121771 - std::tuple CTAD fails for lvalue reference to function type
4
5 #include <tuple>
6 #include <memory>
7
8 void func();
9
10 std::tuple t(func);
11 std::tuple<void (*)()>& r = t;
12
13 struct Explicit {
14 Explicit();
15 explicit Explicit(const Explicit&);
16 } ex;
17
18 std::tuple t2(func, 1);
19 std::tuple<void (*)(), int>& r2 = t2;
20
21 std::tuple t2x(ex, func);
22 std::tuple<Explicit, void (*)()>& r2x = t2x;
23
24 std::tuple t3(1, func, 3);
25 std::tuple<int, void (*)(), int>& r3 = t3;
26
27 std::tuple t3x(ex, 2, func);
28 std::tuple<Explicit, int, void (*)()>& r3x = t3x;
29
30 std::allocator<int> alloc;
31
32 std::tuple ta(std::allocator_arg, alloc, func);
33 std::tuple<void (*)()>& ra = ta;
34
35 std::tuple ta2(std::allocator_arg, alloc, func, 1);
36 std::tuple<void (*)(), int>& ra2 = ta2;
37
38 std::tuple ta2x(std::allocator_arg, alloc, ex, func);
39 std::tuple<Explicit, void (*)()>& ra2x = ta2x;
40
41 std::tuple ta3(std::allocator_arg, alloc, 1, func, 3);
42 std::tuple<int, void (*)(), int>& ra3 = ta3;
43
44 std::tuple ta3x(std::allocator_arg, alloc, ex, 2, func);
45 std::tuple<Explicit, int, void (*)()>& ra3x = ta3x;