[PATCH] D86410: [flang][msvc] Remove ambiguous overload. NFCI.

Michael Kruse via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Aug 22 16:12:46 PDT 2020


Meinersbur created this revision.
Meinersbur added reviewers: DavidTruby, sscalpone, isuruf, klausler, tskeith.
Meinersbur added a project: Flang.
Herald added a reviewer: jdoerfert.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Meinersbur requested review of this revision.

The method `template <int KIND> Result operator()(const TypeParamInquiry<KIND> &)` is defined in `evaluate::GetShapeHelper` as well as in its ancestor `evaluate::Traverse`. Normally, only the overloads of class that first defines method name would be considered, but the declaration `using Base::operator()` imports the base class methods with the same signature. Msvc interprets this as an ambiguity.

The base class method `evaluate::Traverse::operator()(const TypeParamInquiry<KIND> &)` forwards the call to the visitor of its unpacked argument. GCC and Clang call the derived class method in one test case (Semantics/assign04.f90), in which case the base class overload computed the same values as the derived class overload (`Scalar()`). I do not know whether this generally the case.

This patch is part of the series to make flang compilable with MS Visual Studio <http://lists.llvm.org/pipermail/flang-dev/2020-July/000448.html>.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D86410

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


Index: flang/include/flang/Evaluate/shape.h
===================================================================
--- flang/include/flang/Evaluate/shape.h
+++ flang/include/flang/Evaluate/shape.h
@@ -93,9 +93,6 @@
 
   Result operator()(const ImpliedDoIndex &) const { return Scalar(); }
   Result operator()(const DescriptorInquiry &) const { return Scalar(); }
-  template <int KIND> Result operator()(const TypeParamInquiry<KIND> &) const {
-    return Scalar();
-  }
   Result operator()(const BOZLiteralConstant &) const { return Scalar(); }
   Result operator()(const StaticDataObject::Pointer &) const {
     return Scalar();


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D86410.287221.patch
Type: text/x-patch
Size: 631 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200822/238fd0a3/attachment.bin>


More information about the llvm-commits mailing list