compilerplugins/clang/reducevarscope.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
New commits: commit cc3e2e7efa35dea85eecdd163de1ca1e71ce01f7 Author: Stephan Bergmann <sberg...@redhat.com> AuthorDate: Mon Aug 8 15:35:11 2022 +0200 Commit: Stephan Bergmann <sberg...@redhat.com> CommitDate: Mon Aug 8 21:04:30 2022 +0200 Adapt to changed clang::LambdaCapture::getCapturedVar return type ...where <https://github.com/llvm/llvm-project/commit/127bf44385424891eb04cff8e52d3f157fc2cb7c> "[Clang][C++20] Support capturing structured bindings in lambdas" on Clang 16 trunk changed the return type from VarDecl to ValueDecl, causing > compilerplugins/clang/reducevarscope.cxx:541:26: error: no matching member function for call to 'erase' > maVarDeclMap.erase(varDecl); > ~~~~~~~~~~~~~^~~~~ > /usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/unordered_map.h:740:7: note: candidate function not viable: no known conversion from 'ValueDecl *' to 'const_iterator' (aka '_Node_const_iterator<std::pair<const clang::VarDecl *const, (anonymous namespace)::ReduceVarScope::DepthInfo>, __constant_iterators::value, __hash_cached::value>') for 1st argument > erase(const_iterator __position) > ^ > /usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/unordered_map.h:745:7: note: candidate function not viable: no known conversion from 'ValueDecl *' to 'iterator' (aka '_Node_iterator<std::pair<const clang::VarDecl *const, (anonymous namespace)::ReduceVarScope::DepthInfo>, __constant_iterators::value, __hash_cached::value>') for 1st argument > erase(iterator __position) > ^ > /usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/unordered_map.h:762:7: note: candidate function not viable: cannot convert from base class pointer 'ValueDecl *' to derived class pointer 'const key_type' (aka 'const clang::VarDecl *const') for 1st argument > erase(const key_type& __x) > ^ > /usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/unordered_map.h:780:7: note: candidate function not viable: requires 2 arguments, but 1 was provided > erase(const_iterator __first, const_iterator __last) > ^ etc. Change-Id: I79b062ca604435bc83a58eeb32df673e6c658bd6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137984 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sberg...@redhat.com> diff --git a/compilerplugins/clang/reducevarscope.cxx b/compilerplugins/clang/reducevarscope.cxx index be7254a2d569..76eece2131bb 100644 --- a/compilerplugins/clang/reducevarscope.cxx +++ b/compilerplugins/clang/reducevarscope.cxx @@ -537,7 +537,7 @@ bool ReduceVarScope::VisitLambdaExpr(const LambdaExpr* lambdaExpr) const LambdaCapture& capture = *captureIt; if (capture.capturesVariable()) { - auto varDecl = capture.getCapturedVar(); + auto varDecl = cast<VarDecl>(capture.getCapturedVar()); maVarDeclMap.erase(varDecl); maVarUseSourceRangeMap.erase(varDecl); }