Fix GCC 16 (trunk) debug build: real bug + dead unused-but-set-variable cleanup - #728
Merged
Merged
Conversation
GCC 15 enforces -Werror=template-id-cdtor: a class template may not name its own constructors or destructors with explicit template arguments (the injected-class-name must be used without <...>). MathVector and MathMatrix declared several ctors and their dtor as e.g. 'MathVector< T>()' and '~MathVector< T>()', which fails to compile under GCC 15 in C++20 mode and broke the debug build before it reached any core/ code. Drop the '< T>' so these match the injected-class-name form already used by the copy constructors in the same classes. No semantic change.
Same -Werror=template-id-cdtor issue as MathVector/MathMatrix: the default constructor named itself 'OneDHistogram<key1>()' instead of using the injected-class-name. This one only surfaces when something instantiates the ctor (a unit test does), so it slipped past a library-only build and is what broke CI on the previous version of this fix.
…e cleanup GCC 16 (experimental trunk) enables -Werror=unused-but-set-variable more aggressively and flags a genuine correctness issue in CacheableResidueTypeSets's copy constructor. - core/chemical/CacheableResidueTypeSets.cc: the copy constructor passed *this (the not-yet-constructed destination object) to the base class CacheableData's constructor instead of other (the fully-constructed source). Harmless in practice today since CacheableData has no data members of its own, but reads from an object mid-construction and is the pattern GCC 16 correctly flags as -Wmaybe-uninitialized. - protocols/simple_moves/MissingDensityToJumpMover.cc: the default constructor called MissingDensityToJumpMover::get_name() (a qualified, non-virtual call, but still a call through *this) from its own mem-initializer-list to build the Mover base class's name argument. get_name() just returns a string literal, so this is passed directly instead, sidestepping the call-through-a-mid-construction-object pattern GCC 16 flags. - core/scoring/EnergyGraph.hh, core/pose/PDBInfo.cc, core/io/mmtf/mmtf_writer.cc, protocols/cartesian/md.cc, protocols/denovo_design/components/StructureDataFactory.cc, protocols/denovo_design/movers/FoldArchitectMover.cc, protocols/forge/methods/pose_mod.hh, protocols/noesy_assign/DistanceScoreMover.cc, protocols/noesy_assign/StructureDependentPeakCalibrator.cc: remove loop counters (iilag, idx, chainIndex, modelIndex, imap, cur_chain, count, current_pos, ct_peaks, pose_ct) that are incremented alongside a real iterator but never read anywhere in their function. No behavior change. - core/pack/guidance_scoreterms/sap/SapConstraintHelper.cc: offset is deliberately tracked "for symmetry" per an existing comment even though never read; add an explicit (void) cast rather than removing it, preserving that intent while satisfying the warning.
This branch carries the same numeric/ template-id ctor/dtor fix as RosettaCommons#723; run tools/python_cc_reader/beautify_changed_files_in_branch.py over the changed files to restore project-standard formatting the template-id edits had left off: member-initializer lists in MathVector/MathMatrix re-indented one level under their constructors, plus incidental namespace/data-member normalization in OneDHistogram.hh so the beautify check passes. Whitespace-only; no semantic change.
roccomoretti
approved these changes
Jul 3, 2026
lyskov
approved these changes
Jul 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This machine has GCC 12 through GCC 16 (16 is an experimental trunk build) installed side by side. A survey of the debug library build under each version found:
template-id-cdtorfix in Drop template-id from ctor/dtor names in numeric/ (GCC 14/15 -Werror=template-id-cdtor) #723.Building under GCC 16 (with #723's fix applied) surfaced 16 unique
-Werrorsites — mostly-Wunused-but-set-variable, plus two-Wmaybe-uninitializedcases (one of which is a real bug):core/chemical/CacheableResidueTypeSets.cc: the copy constructor initialized its base class withCacheableData(*this)instead ofCacheableData(other), reading from the not-yet-constructed destination object rather than the fully-constructed source. Harmless today only becauseCacheableDatahas no data members of its own; still wrong and exactly what GCC 16 is right to flag.protocols/simple_moves/MissingDensityToJumpMover.cc: the default constructor calledMissingDensityToJumpMover::get_name()(a qualified call through*this, mid-construction) to build an argument for theMoverbase class.get_name()just returns a string literal, so it's passed directly instead — avoids the pattern rather than working around a compiler quirk.EnergyGraph.hh(iilag, 2 of 4 occurrences — the other two are real array indices and are untouched),PDBInfo.cc(idx, x2),mmtf_writer.cc(chainIndex,modelIndex),md.cc(imap),StructureDataFactory.cc(cur_chain),FoldArchitectMover.cc(count),pose_mod.hh(current_pos),DistanceScoreMover.cc(ct_peaks),StructureDependentPeakCalibrator.cc(pose_ct). No behavior change — removed the tracking, left the actual iteration logic untouched.SapConstraintHelper.cc'soffsetis tracked "for symmetry" per an existing comment even though never read. Rather than removing it against that stated intent, added an explicit(void)offset;cast to satisfy the warning.Verified with a clean incremental
mode=debuglibrary build under GCC 16 after each fix.Dependency on #723
The first two commits on this branch are cherry-picked from #723 (
template-id-cdtorfix fornumeric/MathVector.hh,MathMatrix.hh, andOneDHistogram.hh) — GCC 16 hits the identical issue, and it's needed here just to get pastnumeric/far enough to reach the errors this PR actually fixes. No new work is claimed for that part; #723 is the canonical fix and should merge independently of this one. If #723 merges first, rebasing this branch will make those two commits disappear from the diff.