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

--- Comment #8 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:93384ba7e8d7797fc0519116379ba7b549e3bd98

commit r16-8009-g93384ba7e8d7797fc0519116379ba7b549e3bd98
Author: Marek Polacek <[email protected]>
Date:   Mon Mar 9 17:30:26 2026 -0400

    c++/reflection: fix for substituting ^^T::mem [PR124331]

    In compare11.C, the static_assert was wrongly failing because
    compare_reflections got a FIELD_DECL and COMPONENT_REF for ^^S::mem.
    We shouldn't have created the COMPONENT_REF.  So this patch avoids
    creating the COMPONENT_REF by avoiding the finish_qualified_id_expr
    call in tsubst_qualified_id when processing a REFLECT_EXPR.

    Happily, it fixed some other issues too.

    Unfortunately, I found another issue (PR124440) while trying to test
    this patch more extensively.  I plan to fix that separately next.

            PR c++/124331

    gcc/cp/ChangeLog:

            * pt.cc (tsubst_qualified_id): New name_lookup_p parameter.  Don't
            call adjust_result_of_qualified_name_lookup and
            finish_qualified_id_expr if name_lookup_p is false.
            (tsubst_expr) <case REFLECT_EXPR>: Handle SCOPE_REF specially by
            calling tsubst_qualified_id with name_lookup_p=false.

    gcc/testsuite/ChangeLog:

            * g++.dg/reflect/expr13.C: Uncomment the commented out assert.
            * g++.dg/reflect/serialize2.C: Replace #if 0 with #ifdef.
            * g++.dg/reflect/compare11.C: New test.
            * g++.dg/reflect/member21.C: New test.
            * g++.dg/reflect/serialize3.C: New test.

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

Reply via email to