Debian Codegraph @

libstdc++-v3/testsuite/std/ranges/conv/2_neg.cc

raw
1 // { dg-do compile { target c++23 } }
2
3 // C++23 26.5.7 Range conversions [range.utility.conv]
4
5 #include <ranges>
6 #include <vector>
7 #include <testsuite_allocator.h>
8
9 void
10 test_2_1_5()
11 {
12 // (2.1.5) Otherwise, the program is ill-formed.
13
14 using Alloc = __gnu_test::uneq_allocator<int>;
15 using Vec = std::vector<int, Alloc>;
16
17 std::vector<int> v;
18 (void) std::ranges::to<Vec>(v, v.get_allocator()); // { dg-error "here" }
19
20 (void) std::ranges::to<Vec>(Vec{}, 1, 2, 3, 4, 5, 6); // { dg-error "here" }
21 }
22
23 // { dg-error "static assertion failed" "" { target *-*-* } 0 }
24 // { dg-prune-output "no matching function" }