Clang-3.0(#932): workaround for a known problem of Clang-3.0 (Debian/stable)
http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20121203/069267.html http://stackoverflow.com/questions/13521163/variadic-template-as-template-parameter-deduction-works-with-gcc-but-not-with-c Clang aborts the template type deduction due to different size of the argument lists; in fact the missmatching arguments can be filled in perfectly from the default template arguments. As a workaround, we'll include an unused placeholder type parameter into the templated function, to make the match succeed.
This commit is contained in:
parent
cb80d4001a
commit
961936ce9d
1 changed files with 13 additions and 12 deletions
|
|
@ -98,29 +98,30 @@ namespace lib {
|
|||
|
||||
|
||||
private: /* === friend operators injected into enclosing namespace for ADL === */
|
||||
template<typename _O_>
|
||||
//////////////////TICKET #932 Clang is unable to fill in the default template argument. Resolved in newer versions of Clang. Temporary workaround: add second parameter B
|
||||
template<typename _O_,typename B>
|
||||
friend inline bool
|
||||
operator== (P const& p, P<_O_> const& q) { return (p && q)? (*p == *q) : (!p && !q); }
|
||||
operator== (P const& p, P<_O_, B> const& q) { return (p && q)? (*p == *q) : (!p && !q); }
|
||||
|
||||
template<typename _O_>
|
||||
template<typename _O_,typename B>
|
||||
friend inline bool
|
||||
operator!= (P const& p, P<_O_> const& q) { return (p && q)? (*p != *q) : !(!p && !q); }
|
||||
operator!= (P const& p, P<_O_, B> const& q) { return (p && q)? (*p != *q) : !(!p && !q); }
|
||||
|
||||
template<typename _O_>
|
||||
template<typename _O_,typename B>
|
||||
friend inline bool
|
||||
operator< (P const& p, P<_O_> const& q) { REQUIRE (p && q); return *p < *q; } ///< @note deliberately not allowing comparison on NIL ////TICKET #307 : problem with equality test in associative containers, where equal(a,b) := !(a < b) && !(b < a)
|
||||
operator< (P const& p, P<_O_, B> const& q) { REQUIRE (p && q); return *p < *q; } ///< @note deliberately not allowing comparison on NIL ////TICKET #307 : problem with equality test in associative containers, where equal(a,b) := !(a < b) && !(b < a)
|
||||
|
||||
template<typename _O_>
|
||||
template<typename _O_,typename B>
|
||||
friend inline bool
|
||||
operator> (P const& p, P<_O_> const& q) { REQUIRE (p && q); return *q < *p; }
|
||||
operator> (P const& p, P<_O_, B> const& q) { REQUIRE (p && q); return *q < *p; }
|
||||
|
||||
template<typename _O_>
|
||||
template<typename _O_,typename B>
|
||||
friend inline bool
|
||||
operator<= (P const& p, P<_O_> const& q) { REQUIRE (p && q); return *p <= *q;}
|
||||
operator<= (P const& p, P<_O_, B> const& q) { REQUIRE (p && q); return *p <= *q;}
|
||||
|
||||
template<typename _O_>
|
||||
template<typename _O_,typename B>
|
||||
friend inline bool
|
||||
operator>= (P const& p, P<_O_> const& q) { REQUIRE (p && q); return *p >= *q;}
|
||||
operator>= (P const& p, P<_O_, B> const& q) { REQUIRE (p && q); return *p >= *q;}
|
||||
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue