[PATCH] D140803: [clang][Interp] Implement C++ Range-for loops

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 31 12:03:38 PST 2023


aaron.ballman added inline comments.


================
Comment at: clang/test/AST/Interp/loops.cpp:278
+
+namespace RangeForLoop {
+  constexpr int localArray() {
----------------
tbaeder wrote:
> aaron.ballman wrote:
> > You should also add failure tests where the range-based for loop is not valid in a constant expression. Especially interesting cases would be ones involving lifetime problems, such as: https://godbolt.org/z/3EE7f8rdE
> Oof, that reproducer doesn't work right now for several reasons :/ Can you come up with something simpler?
Not trivially, no. Also, that case is now fixed by https://wg21.link/p2644r0 for C++23 due to lifetime extension that we probably don't model yet.


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

https://reviews.llvm.org/D140803



More information about the cfe-commits mailing list