Skip to content

Conversation

@varunagrawal
Copy link
Contributor

When compiling GTSAM with clang (particularly for GPMP2) and -Wc++11-narrowing enabled (which clang is more strict about), I am getting the error

/opt/homebrew/lib/cmake/GTSAM/../../../include/gtsam/base/ProductLieGroup.h:100:33: error: non-type template argument evaluates to 18446744073709551615, which cannot be narrowed to type 'int' [-Wc++11-narrowing]
  typedef Eigen::Matrix<double, dimension2, dimension2> Jacobian2;
                                ^

since dimension2 is of type size_t and the template type for Eigen::Matrix is int.

ChatGPT confirmed this is a signed vs unsigned int issue and I applied a static_cast as it recommended.

Also replaced typedef with using for Jacobian type aliases.

@varunagrawal varunagrawal requested a review from dellaert October 14, 2025 22:18
@varunagrawal varunagrawal self-assigned this Oct 14, 2025
Copy link
Member

@dellaert dellaert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@varunagrawal varunagrawal merged commit 92ac129 into develop Oct 15, 2025
34 checks passed
@varunagrawal varunagrawal deleted the fix-template-type branch October 15, 2025 07:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants