[PATCH] D141472: [clang][Interp] Add function pointers

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 23 12:08:36 PDT 2023


aaron.ballman added a comment.

In D141472#4112790 <https://reviews.llvm.org/D141472#4112790>, @tbaeder wrote:

> I'm not sure what to do about this right now. I was wondering about restructuring pointers so all the metadata is before all the actual data, but that would be a large refactoring.

For right now, we can move forward with basic function pointer support and we can revisit this when you get around to doing member function pointers.



================
Comment at: clang/lib/AST/Interp/ByteCodeExprGen.cpp:970
     return this->emitNullPtr(E);
+  case PT_FnPtr:
   case PT_Float:
----------------
Shouldn't this call `emitNullPtr()` in this case? e.g.,
```
struct S {
  int i;
  void (*fp)();
};

constexpr S s{ 12 };
static_assert(s.fp == nullptr);
```


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

https://reviews.llvm.org/D141472



More information about the cfe-commits mailing list