[lldb-dev] [PATCH] Fix compile warnings with friend inside template
Steve Pucci
spucci at google.com
Fri Jan 17 07:53:53 PST 2014
This is the second piece of the separation of the previously submitted
patch. Notes for this piece (copied from previous email):
The change is to avoid the gcc warning -Wno-non-template-friend that friend
declarations inside template classes must be declared as templates:
http://stackoverflow.com/questions/4039817/friend-declaration-declares-a-non-template-function
Compiled and passed lldb tests on Linux Ubuntu 12.04 and gcc 4.8.2.
Thanks,
Steve
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20140117/afb1689c/attachment.html>
-------------- next part --------------
diff --git a/include/lldb/Utility/Iterable.h b/include/lldb/Utility/Iterable.h
index 9b91cae..1733537 100644
--- a/include/lldb/Utility/Iterable.h
+++ b/include/lldb/Utility/Iterable.h
@@ -147,9 +147,14 @@ public:
return m_iter >= rhs.m_iter;
}
- friend AdaptedConstIterator operator+(typename BackingIterator::difference_type, AdaptedConstIterator &);
- friend typename BackingIterator::difference_type operator-(AdaptedConstIterator &, AdaptedConstIterator &);
- friend void swap(AdaptedConstIterator &, AdaptedConstIterator &);
+ template <typename C1, typename E1, E1 (*A1)(typename C1::const_iterator &)>
+ friend AdaptedConstIterator<C1, E1, A1> operator+(typename C1::const_iterator::difference_type, AdaptedConstIterator<C1, E1, A1> &);
+
+ template <typename C1, typename E1, E1 (*A1)(typename C1::const_iterator &)>
+ friend typename C1::const_iterator::difference_type operator-(AdaptedConstIterator<C1, E1, A1> &, AdaptedConstIterator<C1, E1, A1> &);
+
+ template <typename C1, typename E1, E1 (*A1)(typename C1::const_iterator &)>
+ friend void swap(AdaptedConstIterator<C1, E1, A1> &, AdaptedConstIterator<C1, E1, A1> &);
};
template <typename C, typename E, E (*A)(typename C::const_iterator &)>
More information about the lldb-dev
mailing list