The pointers created through such a cast are not usable in a constant expression as far as I know, but we need to be able to express them. Do that via a Pointer with a nullptr pointee and an Offset that is the given integer.
Details
Details
Diff Detail
Diff Detail
Event Timeline
clang/lib/AST/Interp/ByteCodeExprGen.cpp | ||
---|---|---|
189–193 | This is a tiny hack to get the C test working. |
Comment Actions
I'd expect more test coverage for these changes. Like a C-style cast and a reinterpret_cast in C++ code
Comment Actions
I agree with @aaron.ballman I expect some more tests for this.
clang/lib/AST/Interp/Pointer.h | ||
---|---|---|
70 | Is the only cast we have a Pointer that is a nullptr but has an Offset is from a integral to pointer cast? |
Comment Actions
Note that according to https://clang.llvm.org/docs/ConstantInterpreter.html#pointers, such pointers had their own pointer type (TargetPointer), so I'm not sure if the approach here is the right one.
Comment Actions
I've already abandoned this locally, pretty sure I'll end up taking another approach.
This is a tiny hack to get the C test working.