shafik added inline comments.

================
Comment at: clang/lib/AST/Interp/ByteCodeExprGen.cpp:241
+  // Pointer arithmethic special case. This is supported for one of
+  // LHS and RHS being a pointer type and the other being an integer type.
+  if (BO->getType()->isPointerType()) {
----------------
I am not sure if this is the right place to handle this but there are a bunch 
of other cases.

- `nullptr` can have `0` added or subtracted
- You can only do addition/subtraction from a pointer if the result in within 
bounds or one after the end
- You can subtract two pointers if they point to the same object.

godbolt: https://godbolt.org/z/5YTY93z8M


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D135858

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to