Repository: ericniebler/range-v3

Issue #939: range-v3 should be /W4-clean on MSVC
Created: 2018-11-19T17:45:36Z
When I compile a simple program like this:
#include <range/v3/algorithm.hpp>
#include <vector>

int main()
{
	std::vector<int> v{3, 2, 5, 8, 6, 6, 1, 6, 2};
	ranges::sort( v );
}

with VS2017 15.9 with W4, I get a lot of warnings along the lines of

[...] range\v3\algorithm\sort.hpp(92): warning C4459: declaration of 'next' hides global declaration
[...] range/v3/utility/iterator.hpp(265): note: see declaration of 'ranges::v3::next'

While this is certainly not a bug, it would be nice, if the ranges-v3 headers would compile warning free on a "reasonable warning level" (and yes, I consider W4 to be reasonable, but of course you might disagree).

Duplicate issue #1325: Build error with MSVC 2019 16.3 Preview 4
Created: 2019-09-21T18:41:38Z
This sample program fails to build:
#include <range/v3/algorithm.hpp>

std::vector<int> birdSpecies =
{
     69, 64, 38, 38, 61, 51, 14, 58, 42, 20,
};

int main(void)
{
    ranges::sort(birdSpecies);

    return 0;
}

C:\PROGRA2\MIB0551\2019\Preview\VC\Tools\MSVC\1423~1.281\bin\Hostx86\x86\cl.exe  /nologo /TP  -IC:\Users\fiucha\source\repos\cppcon-ranges\external\lib\ranges\include /DWIN32 /D_WINDOWS /GR /EHsc /Zi /Ob0 /Od /RTC1 -MDd   /W4 /WX /D_USE_MATH_DEFINES /permissive- /experimental:preprocessor /wd5105 -std:c++17 /showIncludes /Fosrc\CMakeFiles\test_sort.dir\test_sort.cpp.obj /Fdsrc\CMakeFiles\test_sort.dir\ /FS -c C:\Users\fiucha\source\repos\cppcon-ranges\src\test_sort.cpp
C:\Users\fiucha\source\repos\cppcon-ranges\external\lib\ranges\include\range/v3/algorithm/sort.hpp(101): error C2220: the following warning is treated as an error
C:\Users\fiucha\source\repos\cppcon-ranges\external\lib\ranges\include\range/v3/algorithm/sort.hpp(101): warning C4459: declaration of 'next' hides global declaration
C:\Users\fiucha\source\repos\cppcon-ranges\external\lib\ranges\include\range/v3/iterator/operations.hpp(335): note: see declaration of 'ranges::next'
C:\Users\fiucha\source\repos\cppcon-ranges\external\lib\ranges\include\range/v3/algorithm/sort.hpp(137): note: see reference to function template instantiation 'void ranges::detail::unguarded_linear_insert<I,C,P>(I,int,C &,P &)' being compiled
with
[
I=std::_Vector_iterator<std::_Vector_val<std::_Simple_types>>,
C=ranges::less,
P=ranges::identity
]
C:\Users\fiucha\source\repos\cppcon-ranges\external\lib\ranges\include\range/v3/algorithm/sort.hpp(153): note: see reference to function template instantiation 'void ranges::detail::unguarded_insertion_sort<std::_Vector_iterator<std::_Vector_val<std::_Simple_types<_Ty>>>,C,P>(I,I,C &,P &)' being compiled
with
[
_Ty=int,
C=ranges::less,
P=ranges::identity,
I=std::_Vector_iterator<std::_Vector_val<std::_Simple_types>>
]
C:\Users\fiucha\source\repos\cppcon-ranges\external\lib\ranges\include\range/v3/algorithm/sort.hpp(206): note: see reference to function template instantiation 'void ranges::detail::final_insertion_sort<I,C,P>(I,I,C &,P &)' being compiled
with
[
I=std::_Vector_iterator<std::_Vector_val<std::_Simple_types>>,
C=ranges::less,
P=ranges::identity
]
C:\Users\fiucha\source\repos\cppcon-ranges\external\lib\ranges\include\range/v3/algorithm/sort.hpp(217): note: see reference to function template instantiation 'std::_Vector_iterator<std::_Vector_val<std::_Simple_types<_Ty>>> ranges::sort_fn::operator ()<std::_Vector_iterator<std::_Vector_val<std::_Simple_types<_Ty>>>,std::_Vector_iterator<std::_Vector_val<std::_Simple_types<_Ty>>>,ranges::less,ranges::identity>(I,S,C,P) const' being compiled
with
[
_Ty=int,
I=std::_Vector_iterator<std::_Vector_val<std::_Simple_types>>,
S=std::_Vector_iterator<std::_Vector_val<std::_Simple_types>>,
C=ranges::less,
P=ranges::identity
]
C:\Users\fiucha\source\repos\cppcon-ranges\src\test_sort.cpp(16): note: see reference to function template instantiation 'std::_Vector_iterator<std::_Vector_val<std::_Simple_types<_Ty>>> ranges::sort_fn::operator ()<std::vector<_Ty,std::allocator<_Ty>>&,ranges::less,ranges::identity>(Rng,C,P) const' being compiled
with
[
_Ty=int,
Rng=std::vector<int,std::allocator> &,
C=ranges::less,
P=ranges::identity
]

Closing comment (2019-09-21T19:47:17Z): It is a perfect duplicate of #939 . Sorry for the noise, I will close this issue.