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):
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:
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, …) }