Reputation: 481
The following code does not compile in visual C++, because the "expression did not evaluate to a constant".
constexpr auto func() {
for (unsigned long long i = 1; i < 10000000UL; ++i);
return 123;
}
constexpr auto f = func();
In general, expressions that take too long to compute, cannot be made constexpr
. Is it possible to give the compiler more time to evaluate such 'difficult' constexpr
essions?
Upvotes: 0
Views: 109
Reputation: 481
The option /constexpr:steps
is exactly the option that describes how long the compiler can think about constexpr
essions.
Upvotes: 1