Engine icon indicating copy to clipboard operation
Engine copied to clipboard

Compilation error when QL_ENABLE_THREAD_SAFE_OBSERVER_PATTERN=ON

Open quantthingy opened this issue 1 year ago • 0 comments

I can successfully build ORE on mac with cmake and QL_ENABLE_THREAD_SAFE_OBSERVER_PATTERN=OFF.

When QL_ENABLE_THREAD_SAFE_OBSERVER_PATTERN=ON, I am getting the following error:

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<Observer>': class QuantExt::CompoEquityIndex -> QuantExt::EquityIndex2 -> EqFxIndexBase -> Observer -> ext::enable_shared_from_this<Observer> class QuantExt::CompoEquityIndex -> LazyObject -> Observer -> ext::enable_shared_from_this<Observer> 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_ptrQuantExt::EquityIndex2, const boost::shared_ptrQuantExt::FxIndex &>' requested here return QuantLib::ext::make_shared<CompoEquityIndex>(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<Observer>': class QuantExt::CompoEquityIndex -> QuantExt::EquityIndex2 -> EqFxIndexBase -> Observer -> ext::enable_shared_from_this<Observer> class QuantExt::CompoEquityIndex -> LazyObject -> Observer -> ext::enable_shared_from_this<Observer> 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_ptrQuantExt::CompoEquityIndex::shared_ptr<QuantExt::CompoEquityIndex, boost::detail::sp_inplace_tag<boost::detail::sp_ms_deleterQuantExt::CompoEquityIndex>>' 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_ptrQuantExt::EquityIndex2, const boost::shared_ptrQuantExt::FxIndex &>' requested here return QuantLib::ext::make_shared<CompoEquityIndex>(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<Y> 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] weak_this = shared_ptr<T>( 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_thisQuantLib::Observer::_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_ptrQuantExt::EquityIndex2, const boost::shared_ptrQuantExt::FxIndex &>' requested here return QuantLib::ext::make_shared<CompoEquityIndex>(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 weak_this_ = shared_ptr<T>( 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_thisQuantLib::Observer::_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_ptrQuantExt::EquityIndex2, const boost::shared_ptrQuantExt::FxIndex &>' requested here return QuantLib::ext::make_shared<CompoEquityIndex>(source_->clone(spotQuote, rate, dividend), fxIndex_); ^ 4 errors generated. make[2]: *** [QuantExt/qle/CMakeFiles/QuantExt.dir/indexes/compoequityindex.cpp.o] Error 1 make[1]: *** [QuantExt/qle/CMakeFiles/QuantExt.dir/all] Error 2

quantthingy avatar Jul 08 '24 03:07 quantthingy