https://gcc.gnu.org/bugzilla/show_bug.cgi?id=128888
--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Actually, it probably isn't related that much to CONST_DECLs.
namespace N {
void foo ();
using N::foo;
static constexpr auto a = ^^N::foo;
}
is also accepts-invalid.
Without flag_reflection what we do is fine.
I think it is name-lookup.cc (do_nonmember_using_decl):
/* A using-decl does not necessarily have the same purview-ness or
exporting as the declaration it reveals, so build a USING_DECL
that we can attach this information to. This also gives us a
location for the using-decl that we can use in diagnostics.
But this is unnecessary if we're just redeclaring the same decl;
in that case we can just mark it purview or exported directly. */
if (value != lookup.value)
So maybe this needs to be value != lookup.value || flag_reflection?
Similarly for type.
Or maybe when P4466 is implemented ignore the reflection-transparent cases
there?