If I have a pure virtual function call, that will currently show up in the sil as:
%0 = ... %1 = function_ref @_ZN5Class2fnEv : $@convention(c) (@inout Class) -> () %2 = apply %1(%0) : $@convention(c) (@inout Class) -> ()
Which is a direct reference to Class::fn() which does not exist resulting in a linker error.
Three possible ideas for resolving this:
- Something like
class_methodthat ideally adjusts the this ptr and returns the computed vtable pointer.
- Detect in IRGen that the original function_ref is virtual and go through a different path.
- Somehow generate an inline thunk (manually construct an inline clang AST and send that through codegen) that takes