lballabio / QuantLib

The QuantLib C++ library
http://quantlib.org
Other
5k stars 1.73k forks source link

Compilation error when QL_ENABLE_THREAD_SAFE_OBSERVER_PATTERN=ON #2009

Closed quantthingy closed 22 hours ago

quantthingy commented 4 days ago

I have been compiling successfully QuantLib on Mac using CMAKE.

When turning QL_ENABLE_THREAD_SAFE_OBSERVER_PATTERN to ON, I am getting the following errors when building /indexes/compoequityindex.cpp.o


In file included from /Users/quantthingy/SoftDev/ore_releases/Engine-1.8.12.1/QuantExt/qle/indexes/compoequityindex.cpp:19: In file included from /Users/quantthingy/SoftDev/ore_releases/Engine-1.8.12.1/QuantExt/qle/indexes/compoequityindex.hpp:26: In file included from /Users/quantthingy/SoftDev/ore_releases/Engine-1.8.12.1/QuantExt/qle/indexes/equityindex.hpp:27: In file included from /Users/quantthingy/SoftDev/ore_releases/Engine-1.8.12.1/QuantLib/ql/currency.hpp:29: In file included from /Users/quantthingy/SoftDev/ore_releases/Engine-1.8.12.1/QuantLib/ql/errors.hpp:29: In file included from /Users/quantthingy/SoftDev/ore_releases/Engine-1.8.12.1/QuantLib/ql/shared_ptr.hpp:33: In file included from /Users/quantthingy/SoftDev/local/mac/include/boost/make_shared.hpp:14: In file included from /Users/quantthingy/SoftDev/local/mac/include/boost/smart_ptr/make_shared.hpp:15: /Users/quantthingy/SoftDev/local/mac/include/boost/smart_ptr/make_shared_object.hpp:262:58: error: ambiguous conversion from derived class 'QuantExt::CompoEquityIndex' to base class 'const boost::enable_shared_from_this': class QuantExt::CompoEquityIndex -> QuantExt::EquityIndex2 -> EqFxIndexBase -> Observer -> ext::enable_shared_from_this class QuantExt::CompoEquityIndex -> LazyObject -> Observer -> ext::enable_shared_from_this boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); ^~~ /Users/quantthingy/SoftDev/ore_releases/Engine-1.8.12.1/QuantExt/qle/indexes/compoequityindex.cpp:76:27: note: in instantiation of function template specialization 'boost::make_shared<QuantExt::CompoEquityIndex, boost::shared_ptr, const boost::shared_ptr &>' requested here return QuantLib::ext::makeshared(source->clone(spotQuote, rate, dividend), fxIndex_); ^ In file included from /Users/quantthingy/SoftDev/ore_releases/Engine-1.8.12.1/QuantExt/qle/indexes/compoequityindex.cpp:19: In file included from /Users/quantthingy/SoftDev/ore_releases/Engine-1.8.12.1/QuantExt/qle/indexes/compoequityindex.hpp:26: In file included from /Users/quantthingy/SoftDev/ore_releases/Engine-1.8.12.1/QuantExt/qle/indexes/equityindex.hpp:27: In file included from /Users/quantthingy/SoftDev/ore_releases/Engine-1.8.12.1/QuantLib/ql/currency.hpp:29: In file included from /Users/quantthingy/SoftDev/ore_releases/Engine-1.8.12.1/QuantLib/ql/errors.hpp:29: In file included from /Users/quantthingy/SoftDev/ore_releases/Engine-1.8.12.1/QuantLib/ql/shared_ptr.hpp:32: In file included from /Users/quantthingy/SoftDev/local/mac/include/boost/shared_ptr.hpp:17: /Users/quantthingy/SoftDev/local/mac/include/boost/smart_ptr/shared_ptr.hpp:304:56: error: ambiguous conversion from derived class 'QuantExt::CompoEquityIndex' to base class 'const boost::enable_shared_from_this': class QuantExt::CompoEquityIndex -> QuantExt::EquityIndex2 -> EqFxIndexBase -> Observer -> ext::enable_shared_from_this class QuantExt::CompoEquityIndex -> LazyObject -> Observer -> ext::enable_shared_from_this boost::detail::sp_enable_shared_from_this( ppx, p, p ); ^ /Users/quantthingy/SoftDev/local/mac/include/boost/smart_ptr/shared_ptr.hpp:387:24: note: in instantiation of function template specialization 'boost::detail::sp_deleter_construct<QuantExt::CompoEquityIndex, QuantExt::CompoEquityIndex>' requested here boost::detail::sp_deleter_construct( this, p ); ^ /Users/quantthingy/SoftDev/local/mac/include/boost/smart_ptr/make_shared_object.hpp:251:28: note: in instantiation of function template specialization 'boost::shared_ptr::shared_ptr<QuantExt::CompoEquityIndex, boost::detail::sp_inplace_tag<boost::detail::sp_ms_deleter>>' requested here boost::shared_ptr< T > pt( static_cast< T >( 0 ), BOOST_SP_MSD( T ) ); ^ /Users/quantthingy/SoftDev/ore_releases/Engine-1.8.12.1/QuantExt/qle/indexes/compoequityindex.cpp:76:27: note: in instantiation of function template specialization 'boost::make_shared<QuantExt::CompoEquityIndex, boost::shared_ptr, const boost::shared_ptr &>' requested here return QuantLib::ext::makeshared(source->clone(spotQuote, rate, dividend), fxIndex_); ^ In file included from /Users/quantthingy/SoftDev/ore_releases/Engine-1.8.12.1/QuantExt/qle/indexes/compoequityindex.cpp:19: In file included from /Users/quantthingy/SoftDev/ore_releases/Engine-1.8.12.1/QuantExt/qle/indexes/compoequityindex.hpp:26: In file included from /Users/quantthingy/SoftDev/ore_releases/Engine-1.8.12.1/QuantExt/qle/indexes/equityindex.hpp:27: In file included from /Users/quantthingy/SoftDev/ore_releases/Engine-1.8.12.1/QuantLib/ql/currency.hpp:29: In file included from /Users/quantthingy/SoftDev/ore_releases/Engine-1.8.12.1/QuantLib/ql/errors.hpp:29: In file included from /Users/quantthingy/SoftDev/ore_releases/Engine-1.8.12.1/QuantLib/ql/shared_ptr.hpp:32: In file included from /Users/quantthingy/SoftDev/local/mac/include/boost/shared_ptr.hpp:17: In file included from /Users/quantthingy/SoftDev/local/mac/include/boost/smart_ptr/shared_ptr.hpp:19: /Users/quantthingy/SoftDev/local/mac/include/boost/smart_ptr/detail/sp_convertible.hpp:49:37: error: ambiguous conversion from derived class 'QuantExt::CompoEquityIndex' to base class 'QuantLib::Observer': class QuantExt::CompoEquityIndex -> QuantExt::EquityIndex2 -> EqFxIndexBase -> Observer class QuantExt::CompoEquityIndex -> LazyObject -> Observer enum _vt { value = sizeof( (f)( static_cast<Y>(0) ) ) == sizeof(yes) }; ^~~~~~ /Users/quantthingy/SoftDev/local/mac/include/boost/smart_ptr/detail/sp_convertible.hpp:82:101: note: in instantiation of template class 'boost::detail::sp_convertible<QuantExt::CompoEquityIndex, QuantLib::Observer>' requested here template< class Y, class T > struct sp_enable_if_convertible: public sp_enable_if_convertible_impl< sp_convertible< Y, T >::value > ^ /Users/quantthingy/SoftDev/local/mac/include/boost/smart_ptr/shared_ptr.hpp:487:66: note: in instantiation of template class 'boost::detail::sp_enable_if_convertible<QuantExt::CompoEquityIndex, QuantLib::Observer>' requested here shared_ptr( shared_ptr const & r, typename boost::detail::sp_enable_if_convertible<Y,T>::type = boost::detail::sp_empty() ) ^ /Users/quantthingy/SoftDev/local/mac/include/boost/smart_ptr/enable_shared_from_this.hpp:80:26: note: while substituting deduced template arguments into function template 'shared_ptr' [with Y = QuantExt::CompoEquityIndex] weakthis = shared_ptr( ppx, py ); ^ /Users/quantthingy/SoftDev/local/mac/include/boost/smart_ptr/shared_ptr.hpp:216:13: note: in instantiation of function template specialization 'boost::enable_shared_from_this::_internal_accept_owner<QuantExt::CompoEquityIndex, QuantExt::CompoEquityIndex>' requested here pe->_internal_accept_owner( ppx, const_cast< Y >( py ) ); ^ /Users/quantthingy/SoftDev/local/mac/include/boost/smart_ptr/make_shared_object.hpp:262:20: note: in instantiation of function template specialization 'boost::detail::sp_enable_shared_from_this<QuantExt::CompoEquityIndex, QuantExt::CompoEquityIndex, QuantLib::Observer>' requested here boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); ^ /Users/quantthingy/SoftDev/ore_releases/Engine-1.8.12.1/QuantExt/qle/indexes/compoequityindex.cpp:76:27: note: in instantiation of function template specialization 'boost::make_shared<QuantExt::CompoEquityIndex, boost::shared_ptr, const boost::shared_ptr &>' requested here return QuantLib::ext::makeshared(source->clone(spotQuote, rate, dividend), fxIndex_); ^ In file included from /Users/quantthingy/SoftDev/ore_releases/Engine-1.8.12.1/QuantExt/qle/indexes/compoequityindex.cpp:19: In file included from /Users/quantthingy/SoftDev/ore_releases/Engine-1.8.12.1/QuantExt/qle/indexes/compoequityindex.hpp:26: In file included from /Users/quantthingy/SoftDev/ore_releases/Engine-1.8.12.1/QuantExt/qle/indexes/equityindex.hpp:27: In file included from /Users/quantthingy/SoftDev/ore_releases/Engine-1.8.12.1/QuantLib/ql/currency.hpp:29: In file included from /Users/quantthingy/SoftDev/ore_releases/Engine-1.8.12.1/QuantLib/ql/errors.hpp:29: In file included from /Users/quantthingy/SoftDev/ore_releases/Engine-1.8.12.1/QuantLib/ql/shared_ptr.hpp:34: In file included from /Users/quantthingy/SoftDev/local/mac/include/boost/enable_shared_from_this.hpp:16: /Users/quantthingy/SoftDev/local/mac/include/boost/smart_ptr/enable_shared_from_this.hpp:80:47: error: ambiguous conversion from derived class 'QuantExt::CompoEquityIndex' to base class 'element_type' (aka 'QuantLib::Observer'): class QuantExt::CompoEquityIndex -> QuantExt::EquityIndex2 -> EqFxIndexBase -> Observer class QuantExt::CompoEquityIndex -> LazyObject -> Observer weakthis = shared_ptr( ppx, py ); ^~ /Users/quantthingy/SoftDev/local/mac/include/boost/smart_ptr/shared_ptr.hpp:216:13: note: in instantiation of function template specialization 'boost::enable_shared_from_this::_internal_accept_owner<QuantExt::CompoEquityIndex, QuantExt::CompoEquityIndex>' requested here pe->_internal_accept_owner( ppx, const_cast< Y >( py ) ); ^ /Users/quantthingy/SoftDev/local/mac/include/boost/smart_ptr/make_shared_object.hpp:262:20: note: in instantiation of function template specialization 'boost::detail::sp_enable_shared_from_this<QuantExt::CompoEquityIndex, QuantExt::CompoEquityIndex, QuantLib::Observer>' requested here boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); ^ /Users/quantthingy/SoftDev/ore_releases/Engine-1.8.12.1/QuantExt/qle/indexes/compoequityindex.cpp:76:27: note: in instantiation of function template specialization 'boost::make_shared<QuantExt::CompoEquityIndex, boost::shared_ptr, const boost::shared_ptr &>' requested here return QuantLib::ext::makeshared(source->clone(spotQuote, rate, dividend), fxIndex_);

boring-cyborg[bot] commented 4 days ago

Thanks for posting! It might take a while before we look at your issue, so don't worry if there seems to be no feedback. We'll get to it.

sweemer commented 4 days ago

Hi @quantthingy looks like compoequityindex comes from ORE, not from QuantLib, so this issue should probably be raised there first.

quantthingy commented 22 hours ago

My bad, will raise to them first.