Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
clang/lib/AST/Interp/ByteCodeStmtGen.cpp | ||
---|---|---|
404–409 | Under what circumstances is there not a condition for a range-based for loop? | |
418–419 | Under what circumstances is there not an increment? | |
clang/test/AST/Interp/loops.cpp | ||
274 | 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 |
clang/lib/AST/Interp/ByteCodeStmtGen.cpp | ||
---|---|---|
418–419 | The answer to both is that I looked at the code for regular for loops and assumed that the restrictions are the same. But looks like there aren't and even isBody() always returns non-null. |
clang/test/AST/Interp/loops.cpp | ||
---|---|---|
274 | Oof, that reproducer doesn't work right now for several reasons :/ Can you come up with something simpler? |
clang/test/AST/Interp/loops.cpp | ||
---|---|---|
274 | 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. |
LGTM; I suspect there's still lifetime issues we are not catching here, but this is incrementally forward progress and we can test the lifetime issues once we have more of the interpreter implemented.
Under what circumstances is there not a condition for a range-based for loop?