NO-JIRA: c++: Fix compile error on clang++ The compile error doesn't happen on gcc, and to my eye the original code looks fine but this version compiles on gcc/clang x 03/11 + MSVC
Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/c41ff065 Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/c41ff065 Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/c41ff065 Branch: refs/heads/go1 Commit: c41ff065887d99740af31dba41cca113d67bc2e8 Parents: e9e0f31 Author: Alan Conway <[email protected]> Authored: Mon Dec 21 09:59:03 2015 -0500 Committer: Alan Conway <[email protected]> Committed: Mon Dec 21 14:49:59 2015 -0500 ---------------------------------------------------------------------- proton-c/bindings/cpp/include/proton/object.hpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/c41ff065/proton-c/bindings/cpp/include/proton/object.hpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/object.hpp b/proton-c/bindings/cpp/include/proton/object.hpp index 34fc5a0..a2457bb 100644 --- a/proton-c/bindings/cpp/include/proton/object.hpp +++ b/proton-c/bindings/cpp/include/proton/object.hpp @@ -54,17 +54,17 @@ template <class T> class pn_ptr : public comparable<pn_ptr<T> >, private pn_ptr_ friend bool operator==(const pn_ptr& a, const pn_ptr& b) { return a.ptr_ == b.ptr_; } friend bool operator<(const pn_ptr& a, const pn_ptr& b) { return a.ptr_ < b.ptr_; } + static pn_ptr take_ownership(T* p) { return pn_ptr<T>(p, true); } + private: T *ptr_; // Note that it is the presence of the bool in the constructor signature that matters // to get the "transfer ownership" constructor: The value of the bool isn't checked. pn_ptr(T* p, bool) : ptr_(p) {} - template <class U> pn_ptr<U> take_ownership(U* p); - friend pn_ptr take_ownership<T>(T* p); }; -template <class T> pn_ptr<T> take_ownership(T* p) { return pn_ptr<T>(p, true); } +template <class T> pn_ptr<T> take_ownership(T* p) { return pn_ptr<T>::take_ownership(p); } ///@endcond INTERNAL --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
