Reputation: 1961
I have a small program that compiles on GCC
but not on MSVC
which 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;
}
}
Upvotes: 1
Views: 8053
Reputation: 3849
C++17 constexpr if
statements are supported since MSVC 19.11.
We can see in the error message that Compiler Explorer currently uses version 19.10.25017.
Upvotes: 3