std::pow
is not a constexpr
function. The reason GCC accepts your code is because it offers a builtin version of pow
, which evaluates the function at compile time since the arguments are known. If you add the -fno-builtin
flag to the GCC command line, your code fails to compile. The error message is as expected:
error: non-constant condition for static assertion
So, this is not a VS2013 bug, but the effect of a GCC optimization. clang doesn't compile the code either.