[PATCH] D137232: [clang][Interp] Support inc/dec operators on pointers
Aaron Ballman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Nov 8 10:59:55 PST 2022
aaron.ballman added inline comments.
================
Comment at: clang/lib/AST/Interp/Opcodes.td:421-425
+// [Pointer] -> []
+def IncPtr : Opcode {
+ let HasGroup = 0;
+}
+// [Pointer] -> []
----------------
Don't both of these result in a `Pointer`? And should they have a `Types` field?
================
Comment at: clang/test/AST/Interp/arrays.cpp:216
- static_assert(getNextElem(E, 1) == 3);
-#endif
+ static_assert(getNextElem(E, 1) == 3, "");
+
----------------
I'd like test cases where the pointer arithmetic has run off the beginning/end of the object (forming the invalid pointer is UB per http://eel.is/c++draft/expr.add#4.3 even if you never dereference the pointer).
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D137232/new/
https://reviews.llvm.org/D137232
More information about the cfe-commits
mailing list