Bug when compiling with MSVC
Closed this issue · 1 comments
mrexodia commented
Godbolt: https://godbolt.org/z/74v6n3
example.cpp
<source>(9): error C2668: 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>::basic_string': ambiguous call to overloaded function
C:/data/msvc/14.28.29333/include\xstring(2496): note: could be 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>::basic_string(std::basic_string<char,std::char_traits<char>,std::allocator<char>> &&) noexcept'
C:/data/msvc/14.28.29333/include\xstring(2413): note: or 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>::basic_string(const _Elem *const )'
with
[
_Elem=char
]
C:/data/msvc/14.28.29333/include\xstring(2754): note: or 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>::basic_string(std::initializer_list<_Elem>,const _Alloc &)'
with
[
_Elem=char,
_Alloc=std::allocator<char>
]
<source>(9): note: while trying to match the argument list '(MainArguments<Input>::Grabber<MainArguments<Input>::DummyValidator>)'
Compiler returned: 2
The weird thing is that everything works fine with GCC and Clang.
Dugy commented
MSVC is not very compliant to standards. It can be made more compliant by disabling its permissive mode with /permissive-
, but it didn't seem to help in this case when I tried it in godbolt. However, I was able to get a workaround because I had experience with this specific problem from using a similar construct and having to do it in MSVC.