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

--- Comment #1 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Marek Polacek <[email protected]>:

https://gcc.gnu.org/g:4e56ca07b9eeb9dd765893b34c147ca398a57f71

commit r17-1925-g4e56ca07b9eeb9dd765893b34c147ca398a57f71
Author: Marek Polacek <[email protected]>
Date:   Fri Jun 26 14:09:38 2026 -0400

    c++/reflection: consteval-only type in splice-spec [PR125900]

    In this test in the template for the

      std::println("{}", static_cast<int>(s.[:member:]));

    line provokes a bogus "consteval-only expressions are only allowed
    in a constant-evaluated context" error.  (Not the line before
    because there we have an OVERLOAD because the second argument's
    type isn't obvious, and so the whole thing is considered type-dep.)

    A splice-specifier is [: constant-expression :], and [expr.const.defns]:
    an expression or conversion is manifestly constant-evaluated if it is
    a constant-expression.

    So I think we shouldn't walk SPLICE_EXPRs in
    check_out_of_consteval_use_r.

            PR c++/125900

    gcc/cp/ChangeLog:

            * reflect.cc (check_out_of_consteval_use_r): Don't walk
            SPLICE_EXPR.

    gcc/testsuite/ChangeLog:

            * g++.dg/reflect/expr18.C: New test.

    Reviewed-by: Jason Merrill <[email protected]>

Reply via email to