I tried to compile on VC++/VS17 a program that I had previously compiled on GCC and Clang without problem. VS17 is generating a whole bunch of errors. It seems that VC++ is struggling with type deduction in the context class specialization using SFINAE.
What is going on ?
The following is an example of a code fragment that compiles without issue under GCC and Clang but fails under VC++.
The following errors came up on CodeMirror using VC++.
source_file.cpp(38): error C2027: use of undefined type 'reverser<std::vector<int,std::allocator<_Ty>> &,std::nullptr_t,std::nullptr_t>'
with
[
_Ty=int
]
source_file.cpp(38): error C2514: 'reverser<std::vector<int,std::allocator<_Ty>> &,std::nullptr_t,std::nullptr_t>': class has no constructors
with
[
_Ty=int
]
source_file.cpp(39): error C2027: use of undefined type 'reverser<std::vector<int,std::allocator<_Ty>> &,std::nullptr_t,std::nullptr_t>'
with
[
_Ty=int
]
source_file.cpp(39): error C2065: 'i': undeclared identifier
Microsoft (R) C/C++ Optimizing Compiler Version 19.00.23506 for x64
The conformance mode needed to be set to -permissive. According to this article. They changed the default project setting starting with VS17 version 15.5, and I was still using version 15.4.
Initially, I didn't bother upgrading VC17 because my code was plain old C++11 and it seemed that even the 2017 version of VC++ should be able to handle it.