[PATCH] D135433: [clang][Interp] Implement while and do-while loops

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 7 12:17:38 PDT 2022


aaron.ballman added inline comments.


================
Comment at: clang/test/AST/Interp/loops.cpp:93
+  }
+  static_assert(f4() == 5, "");
+};
----------------
Can you also add some tests that use nested loops with multiple levels of `break` and `continue` use?

Also, I think it might be useful to show the jump statements causing code to be an invalid constant expression, as in: 
```
constexpr int foo() {
  int i;

  do {
    break;
    i = 12;
  } while (1);

  return i;
}

constexpr int f = foo();
```


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D135433/new/

https://reviews.llvm.org/D135433



More information about the cfe-commits mailing list