Introduce check_consteval_only_fn and call it in grokfndecl
and instantiate_body. Also make std::meta::exception special
member functions consteval.
I couldn't use check_consteval_only_fn in tsubst_function_decl
due to too many failures in libstdc++.
So that the ctors convert UTF-8 what to exec charset or vice versa
and what() is non-constant if UTF-8 to exec charset conversion failed.
This uses two helper meta functions (static private members of
std::meta::exception) which piggyback on reflect_constant_string.
Furthermore, translate compiler thrown std::meta::exception strings
to exec charset.
Note, I think module.cc will need some limited work for REFLECT_EXPR
and/or META_TYPE. Plus maybe because members_of relies on DECL_UIDs
for what has been declared earlier vs. later for both namespaces
(where nothing actually guarantees order, so not a big deal) and
in classes (where the standard guarantees it), so maybe we'll need
to make sure to stream the class content in DECL_UID order.
Unfortunately this needed other changes. I need to have a function to
check if a splice-expression is valid so I had to factor out some code
out to check_splice_expr. Then I realized pt.cc needs to know in which
context the original SPLICE_EXPR was found so that needed two new flags.
compare_reflections has a new hack, but this should be fixed rather soon
on trunk and then the hack can go after a rebase.
I discovered a new ICE, fixed, and tested in crash13.C.
Annotations are to be done, but it should be easy.
Doesn't handle yet https://eel.is/c++draft/meta.reflection#member.queries-3.5.2
nor does it test https://eel.is/c++draft/meta.reflection#member.queries-3.4
undeduced placeholder type, the namespace queries definitely need better
testsuite coverage.
Doesn't handle yet the underlying variables of tuple using namespace
scope structured bindings, doesn't have any tests for structured bindings,
guess structured binding packs need to be tested too.
And for members_of (^^::, access_context::current ()) I guess we need to
decide if e.g. __builtin_ etc. prefixed builtins or anticipated normal identifier
builtins should appear or not.
There is a TODO, don't know how to check for
https://eel.is/c++draft/meta.reflection#access.queries-3.3.1
but when via wasn't used, that doesn't apply, DESIGNATING-CLS is
in that case always the PARENT-CLS and I think that should be always
satisfied.
Plus, there is one ICE somewhere deep in the accessible handling for the
static_assert (is_accessible (N::rb, N::ctx));
case, and disagreement with clang branch on
static_assert (is_accessible (D::rG, ctx));
static_assert (is_accessible (D::rH, ctx));
static_assert (is_accessible (D::rH1, ctx));
and
static_assert (is_accessible (D::rh, ctx));
static_assert (is_accessible (D::rk, ctx));
in thud and
static_assert (!is_accessible (N::rb, gctx));
static_assert (!is_accessible (N::rc, gctx));
and
static_assert (!is_accessible (N::rb, O::ctx));
static_assert (!is_accessible (N::rc, O::ctx));
at global ns. I have no idea what is right or wrong in these
cases, though I'd say at least from global ns N::rb and N::rc shouldn't
be accessible (yes, parent class in that case is the anonymous union,
but still).
Still no idea how to test is_conversion_function_template and
is_constructor_template.
Also, unsure if is_constructor is not incorrect (i.e. whether it
should only return true for FUNCTION_DECLs and not TEMPLATE_DECLs).