You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by am...@apache.org on 2018/04/03 20:17:43 UTC

[trafficserver] branch master updated: Patch for gcc 6 and incorrect template function overload resolution for string_view.

This is an automated email from the ASF dual-hosted git repository.

amc pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/master by this push:
     new eee1997  Patch for gcc 6 and incorrect template function overload resolution for string_view.
eee1997 is described below

commit eee1997ee999fa2982235893c4184b6f0923cfb8
Author: Alan M. Carroll <am...@apache.org>
AuthorDate: Mon Apr 2 17:43:46 2018 -0500

    Patch for gcc 6 and incorrect template function overload resolution for string_view.
---
 lib/ts/TextView.h | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/lib/ts/TextView.h b/lib/ts/TextView.h
index 308d06e..1425950 100644
--- a/lib/ts/TextView.h
+++ b/lib/ts/TextView.h
@@ -973,6 +973,22 @@ TextView::trim_if(F const &pred)
   return this->ltrim_if(pred).rtrim_if(pred);
 }
 
+#if __GNUC__ == 6
+// The super class operators are ambiguous in GCC 6, but not in 5 or 7.
+// As best I can tell, TextView isn't recognized as a subclass of string_view in template deduction.
+bool inline
+operator==(TextView lhs, TextView rhs)
+{
+  return lhs.size() == rhs.size() && 0 == memcmp(lhs.data(), rhs.data(), lhs.size());
+}
+
+bool inline
+operator!=(TextView lhs, TextView rhs)
+{
+  return lhs.size() != rhs.size() || 0 != memcmp(lhs.data(), rhs.data(), lhs.size());
+}
+#endif
+
 inline bool
 TextView::isPrefixOf(super_type const &that) const
 {

-- 
To stop receiving notification emails like this one, please contact
amc@apache.org.