openfheorg / openfhe-development

This is the development repository for the OpenFHE library. The current (stable) version is v1.2.0 (released on June 25, 2024).
BSD 2-Clause "Simplified" License
655 stars 167 forks source link

Non virtual destructor in lbcrypto::Params causes problems for migrating from v1.1.4 to v1.2.0 #825

Open ArseniyKholod opened 1 week ago

ArseniyKholod commented 1 week ago

I have encountered one problem while migrating from v1.1.4 to v1.2.0. We wrap openfhe-development package with CxxWrap.jl to use in Julia language https://github.com/hpsc-lab/openfhe-julia. In the last version update in commit #736, you marked all setters in lbcrypto::Params as virtual. But destructor of this class stays non-virtual: https://github.com/openfheorg/openfhe-development/blob/13bf46f683483da1fe77f591b98035fa455740c6/src/pke/include/scheme/gen-cryptocontext-params.h#L215.

openfhe-development v1.2.0 gets compiled normally, but non virtual destructor in the class with virtual methods causes a compilation problem of openfhe-julia package with Clang 15. It generates a warning: -Wdelete-non-abstract-non-virtual-dtor:

error: delete called on non-final 'lbcrypto::Params' that has virtual functions but non-virtual destructor [-Werror,-Wdelete-non-abstract-non-virtual-dtor]

The same story happens for all lbcrypto::CCParams (lbcrypto::CCParams<CryptoContextBFVRNS>, lbcrypto::CCParams<CryptoContextBGVRNS>, lbcrypto::CCParams<CryptoContextCKKSRNS>), I think it is because they are derived from lbcrypto::Params, but I'm not sure.

I just want to make sure before finding a way around, if a non-virtual destructor in class lbcrypto::Params with virtual methods is desired or not. Is it?)

Thank you very much in advance!