Search code examples
c++visual-studiostatic-assert

static_assert(std::is_abstract) causes a compiler error in Visual Studio 2013


When compiling this line of code in Visual Studio 2013:

static_assert(!std::is_abstract<int>(), "test");

this compiler error is output:

expected constant expression

But the code snippet is presented as an answer in this SO question. Is this a bug in the MSVC++ compiler? Is there a workaround?


Solution

  • MSVC has no constexpr, use std::is_abstract< int >::value