https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123612

--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Even for the block scope externs of functions?
https://godbolt.org/z/cM6fjW4va
#include <meta>
int foo (int);
consteval auto bar () {
  extern int foo (int a = 42);
  static_assert (has_default_argument (parameters_of (^^foo)[0]));
  return ^^foo;
}
static_assert (^^foo == bar ());
static_assert (!has_default_argument (parameters_of (^^foo)[0]));
clang++ fails here the last assertion, g++ the one before it instead.
AFAIK the block scope externs have their own default arguments, that is
something
not shared with the namespace scope declaration, though
Though https://eel.is/c++draft/meta.reflection#queries-41.2 wording seems to be
about not propagating the default argument itself, but a flag whether it has
default argument or had a default argument in any of the corresponding block
scope externs.

Reply via email to