It looks like there's a similar crash with while loops, e.g. "while (int m)". That isn't valid, of course, but we try to perform constexpr evaluation anyway.
-Eli
It looks like there's a similar crash with while loops, e.g. "while (int m)". That isn't valid, of course, but we try to perform constexpr evaluation anyway.
-Eli
It looks like there’s a similar crash with while loops, e.g. “while (int m)”. That isn’t valid, of course, but we try to perform constexpr evaluation anyway.
Yes. That’s at least not really a regression; we’ve crashed for a long time on things like
constexpr int f() {
switch (1) {
while (int m = 1) {
case 1:
return m;
}
}
}
constexpr int k = f();
I guess it’d make sense to just treat this case as non-constant rather than asserting. (Though it does raise a question of what AST invariants it’s safe to rely on from the constant evaluator.)