Work around the GCC bug affecting flexible array members.
For #102.
Change-Id: I0e4270f7e492a59b0ee43c523378b7b9d941f38a
Reviewed-on: https://code-review.googlesource.com/8492
Reviewed-by: Paul Wankadia <junyer@google.com>
diff --git a/re2/dfa.cc b/re2/dfa.cc
index 1fc8a5a..417efc1 100644
--- a/re2/dfa.cc
+++ b/re2/dfa.cc
@@ -123,7 +123,15 @@
uint32_t flag_; // Empty string bitfield flags in effect on the way
// into this state, along with kFlagMatch if this
// is a matching state.
+
+// Work around the bug affecting flexible array members in GCC 6.1 and 6.2.
+// (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70932)
+#if !defined(__clang__) && defined(__GNUC__) && __GNUC__ == 6 && __GNUC_MINOR__ >= 1
+ std::atomic<State*> next_[0]; // Outgoing arrows from State,
+#else
std::atomic<State*> next_[]; // Outgoing arrows from State,
+#endif
+
// one per input byte class
};