1

The following code compiles with c++17 but fails with c++14

undefined reference to `Class<...>::name'

template<char... n>
class Class
{
public:
    static constexpr const char name[sizeof...(n) + 1] = {n..., '\0'};
};

int main()
{
    std::cout << Class<'H', 'e', 'l', 'l', 'o', '!'>::name << std::endl;
    return 0;
}

Why is that so?

I am using g++ (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0

Quest
  • 2,764
  • 1
  • 22
  • 44

0 Answers0