sfwa/ukf

template error with clang

Closed this issue · 5 comments

With: Apple clang version 12.0.5 (clang-1205.0.22.9)

I get multiple errors in Core.h like this:

In file included from ukf/test/TestSquareRootCore.cpp:9:
bazel-out/darwin-fastbuild/bin/ukf/_virtual_includes/ukf/UKF/Core.h:351:24: error: 'calculate_measurement_root_covariance' following the 'template' keyword does not refer to a template
z.template calculate_measurement_root_covariance(measurement_root_covariance, z_pred);
~~~~~~~~ ^
ukf/test/TestSquareRootCore.cpp:264:17: note: in instantiation of function template specialization 'UKF::SquareRootCore<UKF::StateVector<UKF::Field<2, Eigen::Matrix<double, 3, 1, 0>>, UKF::Field<3, Eigen::Matrix<double, 3, 1, 0>>, UKF::Field<0, Eigen::Quaternion<double, 0>>, UKF::Field<1, Eigen::Matrix<double, 3, 1, 0>>>, UKF::DynamicMeasurementVector<UKF::Field<3, Eigen::Matrix<double, 3, 1, 0>>, UKF::Field<4, Eigen::Matrix<double, 3, 1, 0>>, UKF::Field<0, Eigen::Matrix<double, 3, 1, 0>>, UKF::Field<1, UKF::FieldVector>, UKF::Field<2, Eigen::Matrix<double, 3, 1, 0>>>, UKF::IntegratorRK4>::innovation_step<>' requested here
test_filter.innovation_step(m);
^
bazel-out/darwin-fastbuild/bin/ukf/_virtual_includes/ukf/UKF/MeasurementVector.h:682:22: note: declared as a non-template here
CovarianceMatrix calculate_measurement_root_covariance(const CovarianceVector& measurement_root_covariance,
^

Removing the 'template' keyword fixes the problem. Would you like a PR for this, or have I misunderstood the problem?

That was with Xcode 12.5, which is what brought apple-clang-12.0.5 to the party. I tried again with the latest bazel linux docker container, for bazel-3.5.0, and had the same problem (with clang --version reporting 11.0.0).

Hi, thanks for looking into it – I haven't been keeping super up to date recently, but I understand that the most recent versions of the C++ standards have reduced the number of situations in which the 'template' keyword is required to be used.

I've been meaning to do a bit of an overhaul to the repository now that the major compilers' implementations of various modern C++ language features have stabilised, but haven't found time yet.

If you'd like to put in a pull request, that would be most welcome.

thanks, daniel. it appears i need permission to push a branch before i can generate a PR. or is there another way?

PR submitted from a fork.

Issue cleanup—this was fixed by this PR #56