sfwa / ukf

Unscented Kalman Filter library for state and parameter estimation
http://au.tono.my/log/20130531-kalman-filter.html
MIT License
461 stars 172 forks source link

template error with clang #55

Closed johnschlag closed 2 years ago

johnschlag commented 3 years ago

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?
johnschlag commented 3 years ago

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).

danieldyer commented 3 years ago

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.

johnschlag commented 3 years ago

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

johnschlag commented 3 years ago

PR submitted from a fork.

bendyer commented 2 years ago

Issue cleanup—this was fixed by this PR https://github.com/sfwa/ukf/pull/56