https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94510
--- Comment #11 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Jason Merrill <ja...@gcc.gnu.org>: https://gcc.gnu.org/g:587970215f4681def390e2a791aa3ba6adb65158 commit r10-7864-g587970215f4681def390e2a791aa3ba6adb65158 Author: Martin Sebor <mse...@gmail.com> Date: Wed Apr 22 02:27:54 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-22 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-22 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.