<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/106988>106988</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
`std::reverse_iterator<Incomplete*>` causes a compilation failure when checking `input_iterator`
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
strega-nil
</td>
</tr>
</table>
<pre>
The following code:
```cxx
int main() {
struct Incomplete;
static_assert((std::input_iterator<std::reverse_iterator<Incomplete*>>, true));
}
```
causes a compilation failure:
```
# | In file included from /.../libcxx/test/std/containers/views/views.span/span.cons/copy.pass.cpp:15:
# | In file included from /.../span:163:
# | /.../__iterator/reverse_iterator.h:184:76: error: arithmetic on a pointer to an incomplete type 'Incomplete'
# | is_nothrow_copy_constructible_v<_Iter> && noexcept(ranges::iter_move(--std::declval<_Iter&>()))) {
# | ^ ~~~~~~~~~~~~~~~~~~~~~~
# | /.../__iterator/iter_move.h:43:3: note: in instantiation of exception specification for 'iter_move' requested here
# | iter_move(std::forward<_Tp>(__t));
# | ^
# | /.../__iterator/iter_move.h:43:3: note: in instantiation of requirement here
# | iter_move(std::forward<_Tp>(__t));
# | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | /.../__iterator/iter_move.h:41:75: note: while substituting template arguments into constraint expression here
# | concept __unqualified_iter_move = __class_or_enum<remove_cvref_t<_Tp>> && requires(_Tp&& __t) {
# | ^~~~~~~~~~~~~~~~~~~~~
# | /.../__iterator/iter_move.h:63:14: note: while checking the satisfaction of concept '__unqualified_iter_move<std::reverse_iterator<Incomplete *> &>' requested here
# | requires __unqualified_iter_move<_Ip>
# | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | /.../__iterator/iter_move.h:63:14: note: while substituting template arguments into constraint expression here
# | requires __unqualified_iter_move<_Ip>
# | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | /.../__iterator/iter_move.h:93:7: note: (skipping 5 contexts in backtrace; use -ftemplate-backtrace-limit=0 to see all)
# | { ranges::iter_move(__t) } -> __can_reference;
# | ^
# | /.../__iterator/concepts.h:58:7: note: in instantiation of requirement here
# | typename iter_rvalue_reference_t<_In>;
# | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | /.../__iterator/concepts.h:55:5: note: while substituting template arguments into constraint expression here
# | requires(const _In __i) {
# | ^~~~~~~~~~~~~~~~~~~~~~~~~
# | /.../__iterator/concepts.h:66:31: note: while checking the satisfaction of concept '__indirectly_readable_impl<std::reverse_iterator<Incomplete *>>' requested here
# | concept indirectly_readable = __indirectly_readable_impl<remove_cvref_t<_In>>;
# | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | /.../__iterator/concepts.h:66:31: note: while substituting template arguments into constraint expression here
# | concept indirectly_readable = __indirectly_readable_impl<remove_cvref_t<_In>>;
# | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | /.../libcxx/test/std/containers/views/views.span/span.cons/copy.pass.cpp:105:19: note: while checking the satisfaction of concept 'indirectly_readable<std::reverse_iterator<Incomplete *>>' requested here
# | static_assert(std::indirectly_readable<std::reverse_iterator<Incomplete*>>);
# | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | /.../libcxx/test/std/containers/views/views.span/span.cons/copy.pass.cpp:100:12: note: forward declaration of 'Incomplete'
# | struct Incomplete;
# | ^
# | In file included from /.../libcxx/test/std/containers/views/views.span/span.cons/copy.pass.cpp:15:
# | In file included from /.../span:163:
# | /.../__iterator/reverse_iterator.h:186:30: error: arithmetic on a pointer to an incomplete type 'Incomplete'
# | return ranges::iter_move(--__tmp);
# | ^ ~~~~~
# | /.../__iterator/iter_move.h:66:12: note: in instantiation of member function 'std::iter_move' requested here
# | return iter_move(std::forward<_Ip>(__i));
# | ^
# | /.../__iterator/iter_move.h:93:7: note: in instantiation of function template specialization 'std::ranges::__iter_move::__fn::operator()<std::reverse_iterator<Incomplete *> &>' requested here
# | { ranges::iter_move(__t) } -> __can_reference;
# | ^
# | /.../__iterator/iter_move.h:93:7: note: in instantiation of requirement here
# | { ranges::iter_move(__t) } -> __can_reference;
# | ^~~~~~~~~~~~~~~~~~~~~~
# | /.../__iterator/iter_move.h:92:12: note: while substituting template arguments into constraint expression here
# | requires requires(_Tp& __t) {
# | ^~~~~~~~~~~~~~~~~~~~
# | /.../__iterator/concepts.h:58:16: note: while checking constraint satisfaction for template 'iter_rvalue_reference_t<std::reverse_iterator<Incomplete *>>' required here
# | typename iter_rvalue_reference_t<_In>;
# | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | /.../__iterator/concepts.h:58:7: note: in instantiation of requirement here
# | typename iter_rvalue_reference_t<_In>;
# | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | /.../__iterator/concepts.h:55:5: note: while substituting template arguments into constraint expression here
# | requires(const _In __i) {
# | ^~~~~~~~~~~~~~~~~~~~~~~~~
# | /.../__iterator/concepts.h:66:31: note: while checking the satisfaction of concept '__indirectly_readable_impl<std::reverse_iterator<Incomplete *>>' requested here
# | concept indirectly_readable = __indirectly_readable_impl<remove_cvref_t<_In>>;
# | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | /.../__iterator/concepts.h:66:31: note: while substituting template arguments into constraint expression here
# | concept indirectly_readable = __indirectly_readable_impl<remove_cvref_t<_In>>;
# | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | /.../libcxx/test/std/containers/views/views.span/span.cons/copy.pass.cpp:105:19: note: while checking the satisfaction of concept 'indirectly_readable<std::reverse_iterator<Incomplete *>>' requested here
# | static_assert(std::indirectly_readable<std::reverse_iterator<Incomplete*>>);
# | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | /.../libcxx/test/std/containers/views/views.span/span.cons/copy.pass.cpp:100:12: note: forward declaration of 'Incomplete'
# | struct Incomplete;
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzsWUtz4jgX_TVicwvKyBibBQs6CVXZ914l5GvQ17LklmSSfIv57VOywTg80gkdpnpq4nIg-KlzdO7j2Nw5udaIc5J8I8n9gNd-Y-zceYtrPtRSDVYmf5l_3yAURinzJPUahMmRxAsS3ZNo_zmN2lU8P7dbpPZQcqkJzQidAUm_tdsBnLe18PCohSkrhR5JvN_nPPdSMO4cWt-cmTmfh3vFC6mr2jPp0XJvLInvuj0Wt2gd9vf1Lk4XJH4IK70Db2skdBbW_T1Jen8EoY9L8NqhAw7hclJxL42GgktV24sU7H7SGEh6B48aCqkQpBaqzjGHwpoSCF2ORiNCl0quAmV06dF5QpcBFF0Koz2XGq0jdLmV-NR9j1zFdTiu4nokjHbN0dXLqOLOjURVkXgxTg5De98omovGi_E0PjmzO4Yd-KXLY8pHm3B6NiHxIp2SeAFobZiIBXAr_aZELwUYDRwqI7VHC94A12E8u3kC_1IhEJr2py59PRbpmDZ-Y80TC5hZwN-ISa4Usi2J79ijR0viByB0SugUtMFngVXQkuV6jW6nJY-WlWaLhGbDYSekHIXactVdh04b3WQ7yTTrQckdQ8kD_HV2eQ-T3VAaCidhAsIfaBMCYwEykOQ811626jMFtJjCD1ehkIUUO2EaGxjsoUvB4s8ancccNmjx9YgA-kR0NBTGPnGbBxq-Vy0DjPnjuOmuQZKHWwENg5cWS9T-RsMnycP5ufutWRyHOEj66J42IfxcvXJe-tqHNOqxrBT3CNyu6wDRgdTeQKtqHhIoPlcWnQtsnMIXRgcZAGO1_llzJQuJOetGAiS-B8aE4s4xYxnquiTxncWwk4mtxYL5A0mHmNmR7gJv36vdxpbBs-L_HM6a1DOenHImNih-NHxtEBz30hVc7AWy54DQ9AIN7y4U0FYK2Ef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