https://src.fedoraproject.org/rpms/dbus-c++/blob/rawhide/f/dbus-c++-template-operators.patch https://bugs.gentoo.org/737120 https://bugs.gentoo.org/740068 commit a0b9ef3b469ca23c6a3229d8abb967cbbddcee38 Author: Peter Williams Date: Sat Dec 19 21:12:46 2015 -0500 Fix some weird template/operator issues on OS X. I frankly don't understand at all what's going on here. These fixes derive from: https://chromium.googlesource.com/chromiumos/third_party/dbus-cplusplus/+/c3f69f6be02e31521474dce7eadf6ba4f4a7ce94 https://chromium.googlesource.com/chromiumos/third_party/dbus-cplusplus/+/7104857773f790a549d399715482fa23d9b736cd Except I've dropped some changes that break the OS X build for me. Frankly, if it compiles, that's good enough for me. --- a/include/dbus-c++/types.h +++ b/include/dbus-c++/types.h @@ -89,13 +89,7 @@ public: } template - operator T() const - { - T cast; - MessageIter ri = _msg.reader(); - ri >> cast; - return cast; - } + operator T() const; private: @@ -316,7 +310,7 @@ struct type< Struct> (DBus::MessageIter &iter, DBus::Signature return ++iter; } +extern DXXAPI DBus::MessageIter &operator >> (DBus::MessageIter &iter, DBus::Variant &val); + template inline DBus::MessageIter &operator >> (DBus::MessageIter &iter, std::vector& val) { @@ -644,7 +640,16 @@ inline DBus::MessageIter &operator >> (DBus::MessageIter &iter, DBus::Struct> (DBus::MessageIter &iter, DBus::Variant &val); +template +inline DBus::Variant::operator T() const +{ + T cast; + DBus::MessageIter ri = _msg.reader(); + ri >> cast; + return cast; +} + +} /* namespace DBus */ #endif//__DBUSXX_TYPES_H --- a/src/types.cpp +++ b/src/types.cpp @@ -34,7 +34,7 @@ #include "message_p.h" #include "internalerror.h" -using namespace DBus; +namespace DBus { Variant::Variant() : _msg(CallMessage()) // dummy message used as temporary storage for variant data @@ -104,3 +104,4 @@ MessageIter &operator >> (MessageIter &iter, Variant &val) return ++iter; } +} /* namespace DBus */