I just finished upgrading my compiler to C++20 on ubuntu 20.04. g++ version
gives me the following output :
c++ (Ubuntu 10.3.0-1ubuntu1~20.04) 10.3.0
I am trying the following code as suggested on stackoverflow
constexpr int f() {
std::vector<int> v = {1, 2, 3};
return v.size();
}
int main() {
static_assert(f() == 3);
}
But I am getting the following error :
error: variable ‘v’ of non-literal type ‘std::vector<int>’ in ‘constexpr’ function
Am I going wrong somewhere. Or is my installation incorrect