When building gdb with gcc 7.5.0, I run into:
...
gdb/dwarf2/cooked-index.c: In lambda function:
gdb/dwarf2/cooked-index.c:104:5: error: \
the value of ‘_sch_tolower’ is not usable in a constant expression
};
^
In file included from gdbsupport/gdb-safe-ctype.h:47:0,
from gdb/dwarf2/cooked-index.c:34:
include/safe-ctype.h:111:29: note: ‘_sch_tolower’ was not declared ‘constexpr’
extern const unsigned char _sch_tolower[256];
^~~~~~~~~~~~
...
This does not happen with gcc 8.2.1.
Fix this by dropping the constexpr on lambda function munge in
cooked_index_entry::compare for gcc 7.
Tested by completing the build on x86_64-linux.
Approved-By: Tom Tromey <tom@tromey.com>
cooked_index_entry::compare (const char *stra, const char *strb,
comparison_mode mode)
{
+#if defined (__GNUC__) && !defined (__clang__) && __GNUC__ <= 7
+ /* Work around error with gcc 7.5.0. */
+ auto munge = [] (char c) -> unsigned char
+#else
auto munge = [] (char c) constexpr -> unsigned char
+#endif
{
/* Treat '<' as if it ended the string. This lets something
like "func<t>" match "func<t<int>>". See the "Breakpoints in