Re: [PATCH 1/3] Rewrite valid-expr.h's internals in terms of the detection idiom (C++17/N4502)

Tom Tromey
2020-09-28T18:59:39Z

>>>>> "Pedro" == Pedro Alves <pedro@palves.net> writes:

Pedro> + static_assert (gdb::is_detected_exact<EXPR_TYPE, \
Pedro> + archetype, TYPES>::value == VALID, \
Pedro> ""); \

I'm not sure if it was exactly this patch, but after I merged this code
to our internal tree, we started having build problems on a machine that
uses GCC 6.4. I've appended the error message.

I'm not sure it is worth doing anything about this, but I thought it
would be worth noting in case anybody else winds up in this situation.

Tom

../../src/gdb/unittests/offset-type-selftests.c: In substitution of 'template<class Expected, template<class ...> class Op, class ... Args> using is_detected_exact = std::is_same<Expected, typename gdb::detection_detail::detector<gdb::nonesuch, void, Op, Args ...>::type> [with Expected = selftests::offset_type::off_A&; Op = selftests::offset_type::check_valid_expr75::archetype; Args = {selftests::offset_type::off_A, selftests::offset_type::off_B}]':
../../src/gdb/unittests/offset-type-selftests.c:75:1: required from here
../../src/gdb/../gdbsupport/valid-expr.h:65:20: error: type/value mismatch at argument 2 in template parameter list for 'template<class Expected, template<class ...> class Op, class ... Args> using is_detected_exact = std::is_same<Expected, typename gdb::detection_detail::detector<gdb::nonesuch, void, Op, Args ...>::type>'
archetype, TYPES>::value == VALID, \
^
../../src/gdb/../gdbsupport/valid-expr.h:79:3: note: in expansion of macro 'CHECK_VALID_EXPR_INT'
CHECK_VALID_EXPR_INT (ESC_PARENS(typename T1, typename T2), \
^~~~~~~~~~~~~~~~~~~~
../../src/gdb/unittests/offset-type-selftests.c:42:3: note: in expansion of macro 'CHECK_VALID_EXPR_2'
CHECK_VALID_EXPR_2 (off_A, off_B, VALID, EXPR_TYPE, EXPR)
^~~~~~~~~~~~~~~~~~
../../src/gdb/unittests/offset-type-selftests.c:75:1: note: in expansion of macro 'CHECK_VALID'
CHECK_VALID (true, off_A&, lval_a += undrl {});
^~~~~~~~~~~
../../src/gdb/../gdbsupport/valid-expr.h:65:20: note: expected a class template, got 'selftests::offset_type::check_valid_expr75::archetype'
archetype, TYPES>::value == VALID, \
^
../../src/gdb/../gdbsupport/valid-expr.h:79:3: note: in expansion of macro 'CHECK_VALID_EXPR_INT'
CHECK_VALID_EXPR_INT (ESC_PARENS(typename T1, typename T2), \
^~~~~~~~~~~~~~~~~~~~
../../src/gdb/unittests/offset-type-selftests.c:42:3: note: in expansion of macro 'CHECK_VALID_EXPR_2'
CHECK_VALID_EXPR_2 (off_A, off_B, VALID, EXPR_TYPE, EXPR)
^~~~~~~~~~~~~~~~~~
../../src/gdb/unittests/offset-type-selftests.c:75:1: note: in expansion of macro 'CHECK_VALID'
CHECK_VALID (true, off_A&, lval_a += undrl {});
^~~~~~~~~~~