From aa36e31773d65a303c7270267419534a67d28fe0 Mon Sep 17 00:00:00 2001
From: Vasileios Karakasis <vkarak@gmail.com>
Date: Fri, 7 Apr 2017 10:21:47 +0200
Subject: [PATCH] Fixes for the Intel compiler version 16 and 17 (#223)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Proposed patch to master branch:
* Qualify template in `indirect_view` to accommodate incorrect function template specialization determination (icpc ignores §14.8.2.4/9 rule on lvalue versus rvalue template arguments).
* Use parenthesis constructors for type parameter in `pointer_proxy`, as icpc has not adopted the corrected behaviour for DR#1467 [http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#1467].
---
 src/util/indirect.hpp | 4 +++-
 src/util/iterutil.hpp | 4 ++--
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/util/indirect.hpp b/src/util/indirect.hpp
index 1e4dbba8..30501e3d 100644
--- a/src/util/indirect.hpp
+++ b/src/util/indirect.hpp
@@ -38,7 +38,9 @@ template <typename RASeq, typename Seq>
 auto indirect_view(RASeq& data, const Seq& index_map)
 DEDUCED_RETURN_TYPE(transform_view(index_map, impl::indirect_accessor<RASeq&>(data)));
 
-template <typename RASeq, typename Seq>
+// icpc 17 fails to disambiguate without further qualification, so
+// we replace `template <typename RASeq, typename Seq>` with the following:
+template <typename RASeq, typename Seq, typename = util::enable_if_t<!std::is_reference<RASeq>::value>>
 auto indirect_view(RASeq&& data, const Seq& index_map)
 DEDUCED_RETURN_TYPE(transform_view(index_map, impl::indirect_accessor<RASeq>(std::move(data))));
 
diff --git a/src/util/iterutil.hpp b/src/util/iterutil.hpp
index 00e52d62..6c8e1350 100644
--- a/src/util/iterutil.hpp
+++ b/src/util/iterutil.hpp
@@ -89,8 +89,8 @@ auto back(Seq& seq) -> decltype(*std::begin(seq)) {
  */
 template <typename V>
 struct pointer_proxy: public V {
-    pointer_proxy(const V& v): V{v} {}
-    pointer_proxy(V&& v): V{std::move(v)} {}
+    pointer_proxy(const V& v): V(v) {}
+    pointer_proxy(V&& v): V(std::move(v)) {}
     const V* operator->() const { return this; }
 };
 
-- 
GitLab