From 62afc3129dc28638d950c17117347b4e001a613d Mon Sep 17 00:00:00 2001 From: Michael Kruse Date: Tue, 22 Sep 2020 14:20:37 -0500 Subject: [PATCH] [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(void) const' symbol.h(534): note: or 'D *Fortran::semantics::Symbol::detailsIf(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 . Reviewed By: DavidTruby Differential Revision: https://reviews.llvm.org/D88052 --- flang/lib/Semantics/symbol.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flang/lib/Semantics/symbol.cpp b/flang/lib/Semantics/symbol.cpp index c15c604..1e046e0 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() || has(); }, [&](const DerivedTypeDetails &) { - auto *derived{detailsIf()}; + auto *derived{this->detailsIf()}; return derived && derived->isForwardReferenced(); }, [](const auto &) { return false; }, -- 2.7.4