I have the following code:
constexpr unsigned long long power_function(const unsigned long long prime, const unsigned long long iterations) {
return iterations > 0 ? prime * power_function(prime, iterations - 1) : prime;
}
private:
static constexpr unsigned long long prime = power_function(-363, 1'000'000);
IntelliSense complains that it is power_function
used incorrectly. But for my life I canβt understand what the problem is. I am using Visual Studio 2015, FYI.
Error messages:
Error C2131 expression did not evaluate to a constant Basic Server c:\<snip> 28
Error C2131 expression did not evaluate to a constant Basic Server c:\<snip> 33
line 28 corresponds to the line where the return function is, and line 33 corresponds to the line where constexpr is defined.
source
share