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

--- Comment #2 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:eca81a88ed151269a7a1aa7c37c4036995ded6e4

commit r17-5820-geca81a88ed151269a7a1aa7c37c4036995ded6e4
Author: Marek Polacek <[email protected]>
Date:   Thu Oct 8 16:35:18 2026 -0400

    c++/reflection: detect more invalid splice-exprs [PR125631]

    [expr.prim.splice]/2 doesn't actually allow templates in
    a splice-expression of the form splice-specifier, but we are not
    currently detecting that in check_splice_expr, which can mean
    that we crash if the user attempts to use such a splice.

    Also, [expr.prim.splice]/4 allows only function and variable templates
    in the template splice-specialization-specifier form.

    As an extension, we allow function templates, and assume that the
    user forgot to type 'template'.

    mangle3.C was testing invalid cases so replace them with something
    valid.

    This also fixes c++/127802, missing missing_template_diag for dependent
    splices.

            PR c++/127802
            PR c++/125631

    gcc/cp/ChangeLog:

            * cp-tree.h (missing_template_diag): Declare.
            * parser.cc (missing_template_diag): No longer static.
            (cp_parser_splice_expression): Don't call missing_template_diag
            here, but call it...
            * reflect.cc (check_splice_expr): ...here.  Reject (non-function)
            templates.  When template arguments are present, reject
            templates other than function and variable templates.

    gcc/testsuite/ChangeLog:

            * g++.dg/reflect/crash6.C: Adjust dg-error.
            * g++.dg/reflect/mangle3.C: Remove some invalid tests and
            replace them with valid tests.
            * g++.dg/reflect/member22.C: Adjust dg-error.  Add more tests.
            * g++.dg/reflect/splice15.C: Add dg-warning.
            * g++.dg/reflect/splice18.C: New test.
            * g++.dg/reflect/diag7.C: New test.
            * g++.dg/reflect/error15.C: New test.

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

Reply via email to