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

--- 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:cc66476e0991d74fd5a133b095b09a26f373a695

commit r16-7827-gcc66476e0991d74fd5a133b095b09a26f373a695
Author: Marek Polacek <[email protected]>
Date:   Thu Feb 26 15:53:16 2026 -0500

    c++/reflection: reflection is unevaluated operand [PR123608]

    We reject this test with

      error: default argument '^^a' uses local variable 'a'

    However: [dcl.fct.default]/9: "A parameter shall not appear as
    a potentially-evaluated expression in a default argument.", and
    [expr.reflect]/7: "The id-expression of a reflect-expression
    is an unevaluated operand."

    We still have to look at REFLECT_EXPRs in check_out_of_consteval_use_r
    though, otherwise it wouldn't work too well.

            PR c++/123608

    gcc/cp/ChangeLog:

            * cp-tree.h (unevaluated_p): Include REFLECT_EXPR.
            * reflect.cc (check_out_of_consteval_use_r): Don't give up early
            on REFLECT_EXPR_P.

    gcc/testsuite/ChangeLog:

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

    Reviewed-by: Jason Merrill <[email protected]>
  • [Bug c++/123608] [reflection] r... cvs-commit at gcc dot gnu.org via Gcc-bugs

Reply via email to