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

--- Comment #13 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-9 branch has been updated by Jason Merrill
<ja...@gcc.gnu.org>:

https://gcc.gnu.org/g:35699e75a502bb25a2cb23a456e8d6f036b8f226

commit r9-8526-g35699e75a502bb25a2cb23a456e8d6f036b8f226
Author: Martin Sebor <mse...@gmail.com>
Date:   Tue Apr 21 11:02:06 2020 -0400

    c++: reject scalar array initialization with nullptr [PR94510]

    The change committed to GCC 9 to allow string literals as template
arguments
    caused the compiler to prune away, and thus miss diagnosing, conversion
from
    nullptr to int in an array initializer.  After looking at various
approaches
    to improving the pruning, we realized that the only place the pruning is
    necessary is in the mangler.

    gcc/cp/ChangeLog
    2020-04-21  Martin Sebor  <mse...@redhat.com>
                Jason Merrill  <ja...@redhat.com>

            PR c++/94510
            * decl.c (reshape_init_array_1): Avoid stripping redundant trailing
            zero initializers...
            * mangle.c (write_expression): ...and handle them here even for
            pointers to members by calling zero_init_expr_p.
            * cp-tree.h (zero_init_expr_p): Declare.
            * tree.c (zero_init_expr_p): Define.
            (type_initializer_zero_p): Remove.
            * pt.c (tparm_obj_values): New hash_map.
            (get_template_parm_object): Store to it.
            (tparm_object_argument): New.

    gcc/testsuite/ChangeLog
    2020-04-21  Martin Sebor  <mse...@redhat.com>

            PR c++/94510
            * g++.dg/init/array58.C: New test.
            * g++.dg/init/array59.C: New test.
            * g++.dg/cpp2a/nontype-class34.C: New test.
            * g++.dg/cpp2a/nontype-class35.C: New test.

Reply via email to