Commit dc90ec99 authored by Paul Hervot's avatar Paul Hervot
Browse files

core/tuple-automaton: declare `indices` at namespace scope

In C++14, static constexpr expressions that are odr-used must be
declared in the compilation unit at namespace scope even if they are
defined and assigned to in the class.

The `indices` static constexpr attribute of tuple_automaton_impl was
missing that namespace-level declaration, some compiler were fine with
it, but clang 8 isn't, unless compiling with -O1 or higher.

Fix #216
parent afaa9cd7
Pipeline #11782 canceled with stage
...@@ -285,6 +285,16 @@ namespace vcsn ...@@ -285,6 +285,16 @@ namespace vcsn
/// Worklist of state tuples. /// Worklist of state tuples.
std::deque<std::pair<state_name_t, state_t>> todo_; std::deque<std::pair<state_name_t, state_t>> todo_;
}; };
// C++14: declare `indices` at namespace-scope. It is a static constexpr and
// C++14 needs that declaration to make it odr-usable (otherwise, some
// compilers give an undefined reference to it when we it's odr-used)
// This can be removed when compiling in C++17 because this standard
// introduces the concept of inline constexpr and makes all constexpr inline
// by default.
template <Automaton Aut, Automaton... Auts>
constexpr typename tuple_automaton_impl<Aut, Auts...>::indices_t
tuple_automaton_impl<Aut, Auts...>::indices;
} }
/// A tuple automaton as a shared pointer. /// A tuple automaton as a shared pointer.
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment