Three copies of the function-pointer-type builder
- Dominant language
- C++
- Stars
- 11
- Forks
- 4
- Avg merge
- 16h 39m
- Merged PRs (30d)
- 131
Description
The `R(*)(Args...) noexcept(...)` builder exists three times:
- `operator_thunk_for::fn_ptr_type()` in operator_thunks.hh:63
- `member_function_thunk_for::fn_ptr_type()` in member_function_thunks.hh:90
- inline in `generate_vtable_specs`, vtable.hh:93-101
They have already diverged: vtable.hh wraps each parameter type in `dealias`, the two thunk copies use bare `type_of`. Nothing miscompiles today because alias reflections substitute to the same specialisation, but all three must agree for a thunk's partial specialisation to match the vtable entry's type, and a change to one (#397 is one such change) surfaces only as a `find_vtable_entry` or specialisation mismatch deep in an instantiation.
vtable.hh is included by both thunk headers, so one `function_pointer_type_of(std::meta::info)` there can replace all three. While there: `call_through_vtable` takes `Vtable` as an explicit template argument although it is already deducible from the `VtablePtr*` parameter, so a caller can search one vtable type and splice into a pointer of another.
Contributor guide
Assessment
This issue has not been assessed yet.