(2017-12-06) MSVC. VS 15.5 .
auto msvc_does_compile = [](auto _string)
{
using string_type = decltype(_string);
return std::vector<string_type>{};
};
Adding an explicit return type will choke on MSVC, but not gcc / clang, as usual:
auto msvc_does_not_compile = [](auto _string)
-> std::vector< decltype(_string) >
{
using string_type = decltype(_string);
return std::vector<string_type>{};
};
And the same, but simpler, will be stopped even at the IDE stage:
auto msvc_ide_does_not_allow = []( bool wide )
{
if (wide)
return std::vector<std::string>();
return std::vector<std::wstring>();
};
Yes, again, this gcc / clang problem pair has no problems with the above. Try some online ideal that you prefer to convince yourself ...
user5560811
source
share