From 9ad8debe38332a9d61a79e1b0017c19c442f4e49 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Tue, 30 Jul 2019 20:46:55 +0300 Subject: qlalr: fix compilation with C++20 std::not1 is deprecated in C++17, removed in C++20. Use its replacement, std::not_fn. Change-Id: I37d4929c81c2a5befeb44f954ae77b23960d2ff0 Reviewed-by: Ville Voutilainen --- src/tools/qlalr/lalr.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/tools/qlalr/lalr.cpp') diff --git a/src/tools/qlalr/lalr.cpp b/src/tools/qlalr/lalr.cpp index ec960925aa..541523d49c 100644 --- a/src/tools/qlalr/lalr.cpp +++ b/src/tools/qlalr/lalr.cpp @@ -295,6 +295,12 @@ void Automaton::build () buildDefaultReduceActions (); } +#if defined(__cpp_lib_not_fn) && __cpp_lib_not_fn >= 201603 +# define Q_NOT_FN std::not_fn +#else +# define Q_NOT_FN std::not1 +#endif + void Automaton::buildNullables () { bool changed = true; @@ -305,7 +311,7 @@ void Automaton::buildNullables () for (RulePointer rule = _M_grammar->rules.begin (); rule != _M_grammar->rules.end (); ++rule) { - NameList::iterator nn = std::find_if (rule->rhs.begin (), rule->rhs.end (), std::not1 (Nullable (this))); + NameList::iterator nn = std::find_if(rule->rhs.begin(), rule->rhs.end(), Q_NOT_FN(Nullable(this))); if (nn == rule->rhs.end ()) changed |= nullables.insert (rule->lhs).second; @@ -646,7 +652,7 @@ void Automaton::buildIncludesDigraph () if (! _M_grammar->isNonTerminal (*A)) continue; - NameList::iterator first_not_nullable = std::find_if (dot, rule->rhs.end (), std::not1 (Nullable (this))); + NameList::iterator first_not_nullable = std::find_if(dot, rule->rhs.end(), Q_NOT_FN(Nullable(this))); if (first_not_nullable != rule->rhs.end ()) continue; -- cgit v1.2.3