gtsam-3.1.0 fails to compile on OSX due to forward declared template argument
##Issue
gtsam-3.1.0 fails to compile on OSX (AppleClang 5.1.0.5030040, boost 1.55.0) with the error:
boost/ptr_container/detail/reversible_ptr_container.hpp:104:38: error: base class has incomplete type class reversible_ptr_container : CloneAllocator
##Cause
Values.h declares a typedef KeyValueMap using a forward declared ValueCloneAllocator. However, reversible_ptr_container requires access to a default constructor through inheritance. The declaration follows:
boost/ptr_container/detail/reversible_ptr_container.hpp:
class reversible_ptr_container : CloneAllocator
As this is a template argument, forward declaration does not suffice and an explicit constructor must be provided prior to the template declaration.
##Fix
If forward declaration is preferred to keep the implementation in Values-inl.h, then a default constructor must be explicitly defined. The motivation of the forward declaration of ValueCloneAllocator was unclear to me so I moved it into Values.h.
The attached patch can be applied directly to the release/3.1.0 branch.
##Secondary Issue
The above fix addresses the template call error but does not address the fact that:
reversible_ptr_container()
requires public access to the default constructor. The attached patch also removes the private status for the constructor.
##Validation
Running the test suite on the patched system is successful except for those tests that typically fail with Clang.
Comments (3)
-
-
- changed status to resolved
-
reporter @cbeall3: Yes, I am using homebrew.
- Log in to comment
Thanks for reporting this issue. I wasn't able to reproduce this issue on my Mac with identical configuration and Boost 1.55 installed from MacPorts. Are you using Homebrew or something else?
I committed your patch to the develop branch in a84ba5c