I have a small program that compiles on GCC but not on MSVCwhich compiler isn't following the standard for constexpr string_view comparison?
#include <iostream>
#include <string_view>
int main(int argc, char **argv) {
const constexpr auto a = "z";
const constexpr std::string_view test("z",1);
const constexpr std::string_view test2(a,1);
if constexpr(test == test2) {
return 5;
}
else{
return 2;
}
}
if constexpr. This page details C++17 features and says "These features can be enabled by using the /std:c++17 version switch." If I add that switch on Compiler Explorer it tells me it's an unknown option. Have you tried running it locally with the latest MSVC?