Given that the C++ standard library doesn't (currently) provide constexpr versions of the cmath functions, consider the program below.
#include <cmath>
#include <cstring>
int main()
{
constexpr auto a = std::pow(2, 10);
constexpr auto b = std::strlen("ABC");
}
As expected, MSVC++ and clang++ fail to compile this, because constexpr variables are initialized from functions that are not declared constexpr.
g++, however, compiles this. The version of g++ doesn't seem to matter.
(See them all in compiler explorer)
How does g++ achieve this? Is this correct (allowed) compiler behavior?