[flang-commits] [flang] 62afc31 - [flang][msvc] Explicitly reference "this" inside closure. NFC.
Michael Kruse via flang-commits
flang-commits at lists.llvm.org
Tue Sep 22 12:22:55 PDT 2020
Author: Michael Kruse
Date: 2020-09-22T14:22:08-05:00
New Revision: 62afc3129dc28638d950c17117347b4e001a613d
URL: https://github.com/llvm/llvm-project/commit/62afc3129dc28638d950c17117347b4e001a613d
DIFF: https://github.com/llvm/llvm-project/commit/62afc3129dc28638d950c17117347b4e001a613d.diff
LOG: [flang][msvc] Explicitly reference "this" inside closure. NFC.
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>.
Reviewed By: DavidTruby
Differential Revision: https://reviews.llvm.org/D88052
Added:
Modified:
flang/lib/Semantics/symbol.cpp
Removed:
################################################################################
diff --git a/flang/lib/Semantics/symbol.cpp b/flang/lib/Semantics/symbol.cpp
index c15c60406c36..1e046e013c8f 100644
--- a/flang/lib/Semantics/symbol.cpp
+++ b/flang/lib/Semantics/symbol.cpp
@@ -258,7 +258,7 @@ bool Symbol::CanReplaceDetails(const Details &details) const {
return has<SubprogramNameDetails>() || has<EntityDetails>();
},
[&](const DerivedTypeDetails &) {
- auto *derived{detailsIf<DerivedTypeDetails>()};
+ auto *derived{this->detailsIf<DerivedTypeDetails>()};
return derived && derived->isForwardReferenced();
},
[](const auto &) { return false; },
More information about the flang-commits
mailing list