Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows compile fix: Be more specific about which AspectWithState to use #1528

Merged

Conversation

donnyward
Copy link
Contributor

@donnyward donnyward commented Dec 11, 2020

Note: There are other errors that still need to be resolved before /permissive- is no longer needed on Windows.

Using DART (master) in a project on Windows yields the following compile error:

2>C:\...\include\dart/common/AspectWithVersion.hpp(94): error C2974: 'dart::common::detail::AspectWithState': invalid template argument for 'CompositeT', type expected
2>  C:\...\include\dart/common/detail/AspectWithVersion.hpp(53): note: see declaration of 'dart::common::detail::AspectWithState'
2>  C:\...\include\dart/dynamics/EndEffector.hpp(57): note: see reference to class template instantiation 'dart::common::AspectWithStateAndVersionedProperties<dart::dynamics::Support,dart::dynamics::detail::SupportStateData,dart::dynamics::detail::SupportPropertiesData,dart::dynamics::EndEffector,dart::dynamics::detail::SupportUpdate,dart::dynamics::detail::SupportUpdate>' being compiled
2>C:\...\include\dart/common/AspectWithVersion.hpp(94): error C2976: 'dart::common::detail::AspectWithState': too few template arguments
2>  C:\...\include\dart/common/detail/AspectWithVersion.hpp(53): note: see declaration of 'dart::common::detail::AspectWithState'   

This is the same error mentioned in #753.

dart\common\AspectWithVersion.hpp has two symbols for AspectWithState. The first is

dart::common::detail::AspectWithState defined by include:

#include "dart\common\detail\AspectWithVersion.hpp". This takes 5 template arguments.

The second symbol is defined after the above #include as

template <
    class DerivedT,
    typename StateDataT,
    class CompositeT = Composite,
    void (*updateState)(DerivedT*) = &detail::NoOp<DerivedT*> >
using AspectWithState = detail::AspectWithState<
    CompositeTrackingAspect<CompositeT>,
    DerivedT,
    StateDataT,
    CompositeT,
    updateState>;

This version takes 4 template arguments.

The problem is with the following line, Windows is using the first definition of AspectWithState, which is the incorrect version that requires 5 template arguments:

using AspectStateImpl
      = AspectWithState<Derived, StateData, CompositeType, updateState>;

Adding common:: as I've done in the PR distinguishes dart::common::AspectWithState from dart::common::detail::AspectWithState.

Note: This has already been worked around on Windows by compiling with /permissive-, but I think this would still be a good addition to the codebase to make it more robust. Also there are other compile errors that occur without /permissive- that I haven't resolved yet.


Before creating a pull request

  • Document new methods and classes
  • Format new code files using clang-format

Before merging a pull request

  • Set version target by selecting a milestone on the right side
  • Summarize this change in CHANGELOG.md
  • Add unit test(s) for this change

@donnyward donnyward marked this pull request as ready for review December 11, 2020 05:58
@codecov
Copy link

codecov bot commented Dec 11, 2020

Codecov Report

Merging #1528 (27fb6d0) into master (4b0b4dc) will decrease coverage by 0.01%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##           master    #1528      +/-   ##
==========================================
- Coverage   58.18%   58.16%   -0.02%     
==========================================
  Files         414      414              
  Lines       30008    30008              
==========================================
- Hits        17459    17453       -6     
- Misses      12549    12555       +6     
Impacted Files Coverage Δ
dart/common/AspectWithVersion.hpp 42.85% <ø> (ø)
dart/dynamics/EulerJoint.cpp 69.32% <0.00%> (-3.69%) ⬇️

@jslee02 jslee02 added this to the DART 6.10.0 milestone Dec 15, 2020
@jslee02
Copy link
Member

jslee02 commented Dec 15, 2020

Good catch! Thanks for fixing this

@jslee02 jslee02 merged commit 41dac54 into dartsim:master Dec 15, 2020
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.

2 participants