• Jason Rhinelander's avatar
    Make `init_holder` do registration, and rename to `init_instance` · 353615f7
    Jason Rhinelander authored
    The instance registration for offset base types fails (under macOS, with
    a segfault) in the presense of virtual base types.  The issue occurs
    when trying to `static_cast<Base *>(derived_ptr)` when `derived_ptr` has
    been allocated (via `operator new`) but not initialized.
    
    This commit fixes the issue by moving the addition to
    `registered_instances` into `init_holder` rather than immediately after
    value pointer allocation.
    
    This also renames it to `init_instance` since it does more than holder
    initialization now.  (I also further renamed `init_holder_helper` to
    `init_holder` since `init_holder` isn't used anymore).
    
    Fixes #959.
    353615f7
test_multiple_inheritance.cpp 8.55 KB