Commit 0614bbb
Patrick Palka
libstdc++: Avoid hard error in ranges::unique_copy [PR100770]
Here, in the constexpr if condition within ranges::unique_copy, when
input_iterator<_Out> isn't satisfied we must avoid substituting into
iter_value_t<_Out> because the latter isn't necessarily well-formed
then. To that end, this patch factors out the condition into a concept
and uses it throughout.
This patch also makes the definition of our testsuite
output_iterator_wrapper more minimal by setting its value_type, pointer
and reference member types to void. This means our existing tests for
unique_copy already exercise the fix for this bug, so we don't need
to add another test. The only other fallout of this testsuite iterator
change appears in std/ranges/range.cc, where the use of range_value_t
on a test_output_range is now ill-formed.
libstdc++-v3/ChangeLog:
* include/bits/ranges_algo.h (__detail::__can_reread_output):
Factor out this concept from ...
(__unique_copy_fn::operator()): ... here. Use the concept
throughout.
* testsuite/std/ranges/range.cc: Remove now ill-formed use
of range_value_t on an output_range.
* testsuite/util/testsuite_iterators.h (output_iterator_wrapper):
Define value_type, pointer and reference member types to void.1 parent cd4dd47 commit 0614bbb
File tree
3 files changed
+11
-10
lines changed- libstdc++-v3
- include/bits
- testsuite
- std/ranges
- util
3 files changed
+11
-10
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1396 | 1396 | | |
1397 | 1397 | | |
1398 | 1398 | | |
| 1399 | + | |
| 1400 | + | |
| 1401 | + | |
| 1402 | + | |
| 1403 | + | |
| 1404 | + | |
| 1405 | + | |
1399 | 1406 | | |
1400 | 1407 | | |
1401 | 1408 | | |
| |||
1407 | 1414 | | |
1408 | 1415 | | |
1409 | 1416 | | |
1410 | | - | |
1411 | | - | |
| 1417 | + | |
1412 | 1418 | | |
1413 | 1419 | | |
1414 | 1420 | | |
| |||
1432 | 1438 | | |
1433 | 1439 | | |
1434 | 1440 | | |
1435 | | - | |
1436 | | - | |
| 1441 | + | |
1437 | 1442 | | |
1438 | 1443 | | |
1439 | 1444 | | |
| |||
1467 | 1472 | | |
1468 | 1473 | | |
1469 | 1474 | | |
1470 | | - | |
1471 | | - | |
| 1475 | + | |
1472 | 1476 | | |
1473 | 1477 | | |
1474 | 1478 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | 78 | | |
82 | 79 | | |
83 | 80 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
122 | 122 | | |
123 | 123 | | |
124 | 124 | | |
125 | | - | |
| 125 | + | |
126 | 126 | | |
127 | 127 | | |
128 | 128 | | |
| |||
0 commit comments