[flang-commits] [PATCH] D86410: [flang][msvc] Avoid ambiguous overload from base class. NFC.

Michael Kruse via Phabricator via flang-commits flang-commits at lists.llvm.org
Mon Aug 24 11:57:56 PDT 2020


Meinersbur updated this revision to Diff 287460.
Meinersbur added a comment.

Use explicit method specializations in base class.

This solution is also accepted by msvc. A specialization TypeParamInquiry<16> is needed as well, otherwise it does not compiler.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D86410/new/

https://reviews.llvm.org/D86410

Files:
  flang/include/flang/Evaluate/traverse.h


Index: flang/include/flang/Evaluate/traverse.h
===================================================================
--- flang/include/flang/Evaluate/traverse.h
+++ flang/include/flang/Evaluate/traverse.h
@@ -120,9 +120,27 @@
       return visitor_(x.GetFirstSymbol());
     }
   }
-  template <int KIND> Result operator()(const TypeParamInquiry<KIND> &x) const {
+
+  // Workaround for compilation with msvc. The compiler has difficulty
+  // prioritizing templated method imported with the using-declaration in
+  // derived classes. Therefore, instead of a templated method, declare all
+  // parameter specializations.
+  Result operator()(const TypeParamInquiry<1> &x) const {
+    return visitor_(x.base());
+  }
+  Result operator()(const TypeParamInquiry<2> &x) const {
+    return visitor_(x.base());
+  }
+  Result operator()(const TypeParamInquiry<4> &x) const {
     return visitor_(x.base());
   }
+  Result operator()(const TypeParamInquiry<8> &x) const {
+    return visitor_(x.base());
+  }
+  Result operator()(const TypeParamInquiry<16> &x) const {
+    return visitor_(x.base());
+  }
+
   Result operator()(const Triplet &x) const {
     return Combine(x.lower(), x.upper(), x.stride());
   }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D86410.287460.patch
Type: text/x-patch
Size: 1211 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20200824/68cdc394/attachment.bin>


More information about the flang-commits mailing list