The GitHub Actions job "Fory CI" on 
fory.git/support_private_fields_of_cpp_class has failed.
Run started by GitHub user chaokunyang (triggered by chaokunyang).

Head commit for run:
bd1b1578ed3cd2f16f36a8f09e70488a60b9bb1e / Shawn Yang <[email protected]>
fix(cpp): use static method indirection in FORY_STRUCT to avoid MSVC RTTI 
access violation

The previous fix (removing constexpr) worked locally but failed on CI
with Windows Server 2022 MSVC. The issue is that directly constructing
ForyFieldInfoDescriptor in a friend constexpr function body causes
RTTI access violations for polymorphic types on MSVC.

This fix adds a static constexpr get() method to ForyFieldInfoDescriptor
and calls it from the friend function instead of direct construction:

Before (FAILED on CI):
  friend auto ForyFieldInfo(...) noexcept {
    return ForyFieldInfoDescriptor{...};  // RTTI error on polymorphic types
  }

After (WORKS):
  struct ForyFieldInfoDescriptor {
    static constexpr auto get() noexcept { return ForyFieldInfoDescriptor{...}; 
}
  };
  friend constexpr auto ForyFieldInfo(...) noexcept {
    return ForyFieldInfoDescriptor::get();  // No RTTI error
  }

The indirection through a static method avoids MSVC's RTTI access issue
while preserving constexpr semantics. All 27 C++ tests pass locally.

Tests fixed:
- SmartPtrSerializerTest.MaxDynDepthExceeded
- SmartPtrSerializerTest.MaxDynDepthSufficient
- SmartPtrSerializerTest.NonDynamicFieldWithForyField

Report URL: https://github.com/apache/fory/actions/runs/21318324160

With regards,
GitHub Actions via GitBox


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to