From b90b377b85faff9eb1b46bddbbb511128b378835 Mon Sep 17 00:00:00 2001 From: Filip Leonarski Date: Sat, 26 Sep 2026 21:54:58 +0200 Subject: [PATCH] rugnux --mode scale: hold the merge cell by value, not a reference into a temporary GetUnitCell() returns std::optional by value, so a reference to its value() dangled at the end of the statement (clang -Wdangling-gsl). Co-Authored-By: Claude Opus 5.5 (1M context) Claude-Session: https://claude.ai/code/session_01D1G8gJVAy6gp1K5Dz3NE5C --- rugnux/rugnux_cli.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rugnux/rugnux_cli.cpp b/rugnux/rugnux_cli.cpp index c50bcea33..8eb64c648 100644 --- a/rugnux/rugnux_cli.cpp +++ b/rugnux/rugnux_cli.cpp @@ -1634,7 +1634,7 @@ static int RunRugnux(int argc, char **argv) { // each frame's own goniometer rotation. Say so here, where both cells can be named, instead of // merging indices in a frame they do not belong to. { - const auto &merge_cell = experiment.GetUnitCell().value(); + const UnitCell merge_cell = experiment.GetUnitCell().value(); const float dist_tol = experiment.GetIndexingSettings().GetUnitCellDistTolerance(); const float ang_tol = experiment.GetIndexingSettings().GetUnitCellAngleTolerance_deg(); size_t n_indexed = 0, n_agree = 0; @@ -1677,7 +1677,7 @@ static int RunRugnux(int argc, char **argv) { // the observations in another. Nothing downstream can notice, so the check belongs here, with // both the cell and the group in hand. if (const auto merge_sg = experiment.GetGemmiSpaceGroup()) { - const auto &uc = experiment.GetUnitCell().value(); + const UnitCell uc = experiment.GetUnitCell().value(); const double violation = MetricViolation(uc, *merge_sg); if (violation > MAX_METRIC_VIOLATION) { logger.Error("The space group {} cannot describe this cell: a={:.3f} b={:.3f} c={:.3f} "