I'm having some difficulties with static constexpr attributes: it works with integral types, with enum class members, but when I try to do it with a statically initialized integral array it fails at linking saying undefined reference to S::a inside main.
That is with either clang 3.9 or g++ 6.3, and ld 2.27.90; and all that with -std=c++14.
Here is the quickest snippet to reproduce this:
struct S { static constexpr int a[5] = {0}; }; int main() { S s{}; [[gnu::unused]] int b = s.a[0]; // force S stuff to be emitted return 0; } Thank you for any suggestion you may have for this situation.
constexpr int S::a[5];