c++ linker error and undefined reference when accessing static constexpr member – Ubuntu
#include <stddef.h> #include <array> struct S { static constexpr std::array<int,5> sca = {1,2,3,4,5}; static constexpr int foo(size_t i) { return sca[i]; } }; int main(int argc, char **argv) { S s; return s.foo(4); } Compiling this gives me a linker…