From c875618506cf4c6da09ba23542dc5ffaedca7ad3 Mon Sep 17 00:00:00 2001 From: Tim Keith Date: Sat, 22 Feb 2020 11:47:04 -0800 Subject: [PATCH] [flang] Remove use of std::set::merge Some versions of clang that we are building with don't have std::set::merge, even though it is part of C++17. Work around that by using std::set::insert until we can count on merge being available everywhere. Original-commit: flang-compiler/f18@886ccc37fbff5df00717ac728e2aba240d0a314c Reviewed-on: https://github.com/flang-compiler/f18/pull/1014 --- flang/lib/Semantics/check-do-forall.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/flang/lib/Semantics/check-do-forall.cpp b/flang/lib/Semantics/check-do-forall.cpp index 615e100..6dfd51c 100644 --- a/flang/lib/Semantics/check-do-forall.cpp +++ b/flang/lib/Semantics/check-do-forall.cpp @@ -763,13 +763,27 @@ private: common::visitors{ [&](const evaluate::Assignment::BoundsSpec &spec) { for (const auto &bound : spec) { +// TODO: this is working around missing std::set::merge in some versions of +// clang that we are building with +#ifdef __clang__ + auto boundSymbols{evaluate::CollectSymbols(bound)}; + symbols.insert(boundSymbols.begin(), boundSymbols.end()); +#else symbols.merge(evaluate::CollectSymbols(bound)); +#endif } }, [&](const evaluate::Assignment::BoundsRemapping &remapping) { for (const auto &bounds : remapping) { +#ifdef __clang__ + auto lbSymbols{evaluate::CollectSymbols(bounds.first)}; + symbols.insert(lbSymbols.begin(), lbSymbols.end()); + auto ubSymbols{evaluate::CollectSymbols(bounds.second)}; + symbols.insert(ubSymbols.begin(), ubSymbols.end()); +#else symbols.merge(evaluate::CollectSymbols(bounds.first)); symbols.merge(evaluate::CollectSymbols(bounds.second)); +#endif } }, [](const auto &) {}, -- 2.7.4