Skip to content

Fix Clang build error in ternary generator - #1361

Open
dsuponitskiy wants to merge 4 commits into
devfrom
1360-fix-a-build-error-in-generateinteger
Open

dsuponitskiy wants to merge 4 commits into
devfrom
1360-fix-a-build-error-in-generateinteger

Conversation

@dsuponitskiy

Copy link
Copy Markdown
Collaborator

Make m_distribution an inline static member so it is defined when GenerateInteger is instantiated from the header. This fixes the -Wundefined-var-template error in UnitTestDistrGen.cpp.

@dsuponitskiy dsuponitskiy added this to the Release 1.6.0 milestone Sep 27, 2026
@dsuponitskiy dsuponitskiy self-assigned this Sep 27, 2026
@dsuponitskiy dsuponitskiy added the bug Something isn't working label Sep 27, 2026
@dsuponitskiy dsuponitskiy linked an issue Sep 27, 2026 that may be closed by this pull request
@dsuponitskiy
dsuponitskiy force-pushed the 1360-fix-a-build-error-in-generateinteger branch 3 times, most recently from dfb00ad to c004eb2 Compare October 7, 2026 22:03
Make m_distribution an inline static member so it is defined when GenerateInteger is instantiated from the header.
This fixes the -Wundefined-var-template error in UnitTestDistrGen.cpp.
- Converted static members with trivial .cpp definitions to C++17 inline (constexpr where possible) across core and pke:
PackedEncoding, StdLatticeParm, DiscreteFourierTransform, HashUtil, BigIntegerFixedT, myZZ, CryptoContextImpl/Factory,
FHECKKSRNS and the FTT/Bluestein/Arb transform caches in all 4 backends (their definitions in *-impl.h are gone now).
- Moved members that were public for no reason to private (Bluestein caches need a friend declaration for
ChineseRemainderTransformArb*). Dropped the unused and never defined BigIntegerFixedT::m_modChain.
- PseudoRandomNumberGenerator::m_prng has to keep its .cpp definition: gcc rejects "#pragma omp threadprivate" after
an in-class definition.
… inline static cleanup

Initialize StandardLatticeParmSets from an inline factory function so stdlatticeparms.cpp no longer defines it,
turn GLOBALS::precomputeCRTTables into an inline static with friend accessors, and make the Log2/UIntBitWidth type traits constexpr.
Also move the StandardLatticeParmSets table back to the cpp file: the header keeps an inline member initialized from
a factory function that is now defined out of line, so the table is compiled only once.
@dsuponitskiy
dsuponitskiy force-pushed the 1360-fix-a-build-error-in-generateinteger branch from 3856a46 to 68a2fb0 Compare October 11, 2026 03:12

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix a build error in GenerateInteger()

2 participants