[flang-commits] [PATCH] D88052: [flang][msvc] Explicitly reference "this" inside closure. NFC.

Michael Kruse via Phabricator via flang-commits flang-commits at lists.llvm.org
Mon Sep 21 15:40:25 PDT 2020


Meinersbur created this revision.
Meinersbur added reviewers: isuruf, DavidTruby, sscalpone, 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 Microsoft compiler seems to have difficulties to decide between a const/non-const method of a captured object context in a closure. The error message is:

  symbol.cpp(261): error C2668: 'Fortran::semantics::Symbol::detailsIf': ambiguous call to overloaded function
  symbol.h(535): note: could be 'const D *Fortran::semantics::Symbol::detailsIf<Fortran::semantics::DerivedTypeDetails>(void) const'
  symbol.h(534): note: or       'D *Fortran::semantics::Symbol::detailsIf<Fortran::semantics::DerivedTypeDetails>(void)'
  symbol.cpp(261): note: while trying to match the argument list '()'

Explicitly using the this-pointer resolves this problem.

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/D88052

Files:
  flang/lib/Semantics/symbol.cpp


Index: flang/lib/Semantics/symbol.cpp
===================================================================
--- flang/lib/Semantics/symbol.cpp
+++ flang/lib/Semantics/symbol.cpp
@@ -258,7 +258,7 @@
               return has<SubprogramNameDetails>() || has<EntityDetails>();
             },
             [&](const DerivedTypeDetails &) {
-              auto *derived{detailsIf<DerivedTypeDetails>()};
+              auto *derived{this->detailsIf<DerivedTypeDetails>()};
               return derived && derived->isForwardReferenced();
             },
             [](const auto &) { return false; },


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D88052.293271.patch
Type: text/x-patch
Size: 597 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20200921/dbaf574b/attachment.bin>


More information about the flang-commits mailing list