I can't really find good information related to where the standard library uses constexpr functions.
To my surprise, something like this compiled, even though due to the enums it must be calculating value at compile time, right?
1 2 3 4 5 6 7 8
|
#include <cmath>
enum class Foo : int {
value = static_cast<int>(std::pow(3.3, 3.3))
};
#include <iostream>
int main() {
std::cout << static_cast<int>(Foo::value) << std::endl;
}
|
The same applies to other functions I tested in <cmath>.
But when I check the reference page
http://www.cplusplus.com/reference/cmath/pow/ I see nothing about if it's defined as constexpr or not.
So how do I know whether a function in the standard library is constexpr? Even if I look through the header files, is this behavior standard or implementation specific?
__________________________________
Edit: After more searching, I found an answer
http://stackoverflow.com/questions/27744079/is-it-a-conforming-compiler-extension-to-treat-non-constexpr-standard-library-fu
So apparently it's not allowed, but GCC appears to allow it anyway...? Correct me if I misunderstand.
So is there a way to undo the GCC extension to make it conform to standard?