Issue 161685
Summary [Clang][ByteCode] Add numeric-only `TYPE_SWITCH` to avoid Pointer/MemberPointer instantiation in vector handlers
Labels clang
Assignees
Reporter AdityaC4
    In `InterpBuiltin.cpp`, `TYPE_SWITCH` expands over all `PrimType`s (incl. `PT_Ptr`/`PT_MemberPtr`). For vector extract/insert we need a **numeric-only** dispatch (ints + float). Pointer types don’t have `toAPSInt()` and cause compile errors.

Repro (sketch):
```cpp
PrimType PT = Vec.getFieldDesc()->getPrimType();
TYPE_SWITCH(PT, {
  // Integer path needs toAPSInt(); float path pushes Floating.
  // Pointer/MemberPointer cases get instantiated and don’t compile.
});
```
Error:
```cpp
error: no member named 'toAPSInt' in 'clang::interp::Pointer'
error: no member named 'toAPSInt' in 'clang::interp::MemberPointer'
```
Expected: A macro that dispatches over ints + float only, excluding Bool/Ptr/MemberPtr/FixedPoint.

Context: Found while adding constexpr for X86 `vec_ext`/`vec_set`. PR: #161302 
Current workaround: `if (PT == PT_Float) { … } else { INT_TYPE_SWITCH_NO_BOOL(PT, …) }`
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to