Skip to content

<memory>: ranges::uninitialized_copy() emits error C3861: '_Rewrap_iterator': identifier not found #1830

@StephanTLavavej

Description

@StephanTLavavej
C:\Temp>type meow.cpp
#ifdef WORKAROUND
#include <algorithm>
#endif // WORKAROUND

#include <array>
#include <cassert>
#include <memory>
using namespace std;

int main() {
    const array<int, 5> src{11, 22, 33, 44, 55};
    array<int, 5> dst{-1, -1, -1, -1, -1};

    ranges::uninitialized_copy(src, dst);

    assert(dst[2] == 33);
}
C:\Temp>cl /EHsc /nologo /W4 /std:c++latest meow.cpp && meow
meow.cpp
D:\GitHub\STL\out\build\x86\out\inc\memory(68): error C3861: '_Rewrap_iterator': identifier not found
D:\GitHub\STL\out\build\x86\out\inc\memory(68): note: '_Rewrap_iterator': function was not declared in the template definition context and can be found only via argument-dependent lookup in the instantiation context
meow.cpp(14): note: see reference to function template instantiation 'std::ranges::in_out_result<std::_Array_const_iterator<_Ty,5>,std::_Array_iterator<_Ty,5>> std::ranges::_Uninitialized_copy_fn::operator ()<const std::array<_Ty,5>&,std::array<_Ty,5>&>(_Rng1,_Rng2) const' being compiled
        with
        [
            _Ty=int,
            _Rng1=const std::array<int,5> &,
            _Rng2=std::array<int,5> &
        ]

C:\Temp>cl /EHsc /nologo /W4 /std:c++latest /DWORKAROUND meow.cpp && meow
meow.cpp

C:\Temp>

Definition:

STL/stl/inc/algorithm

Lines 218 to 220 in 4ee3f91

// FUNCTION TEMPLATE _Rewrap_iterator
template <forward_range _Rng, class _It>
_NODISCARD constexpr iterator_t<_Rng> _Rewrap_iterator(_Rng&& _Range, _It&& _Val) {

Usage:

return {_STD move(_First1), _Rewrap_iterator(_Range2, _STD move(_UResult.out))};

_Rewrap_iterator definitely needs to be defined in a centralized location.

Reported as DevCom-1394583 / VSO-1310327 / AB#1310327 .

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingfixedSomething works now, yay!rangesC++20/23 ranges

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions