c++: Fix mangling of aggregates containing std::meta::info [PR126922]

We ICE during mangling on the following testcase.
There are two problems on it.
One is the use of build_zero_cst for skipped members when
using designated initializers.  build_zero_cst is a gcc/tree.cc
function, so it doesn't know about META_TYPE and how to create a zero
constant for it.
We could call probably build_zero_init instead, but it does significantly
more work and apparently (from what I've been playing with e.g. using
pointer-to-data-member types etc.) it isn't needed except for the reflection
case, so this patch just calls get_null_reflection () for reflections
and keeps using build_zero_cst for everything else.
Another problem is that we mangle
A { .a = {}, .b = {} }
vs.
A { .a = {} }
differently, although both have the same value.  If a and b fields have
pointer-to-data-member type instead (or int), the zero initialized members
are skipped from the tl value list, and this patch changes zero_init_expr_p
so that it handles null reflections the same way (before P4101 mangling
is probably the only way to observe whether null reflection is all zeros or
not).

2026-08-31  Jakub Jelinek  <jakub@redhat.com>

	PR c++/126922
	* mangle.cc (write_expression): For CONSTRUCTOR skipped
	member of std::meta::info type, call write_expression on
	get_null_reflection rather than build_zero_cst.
	* tree.cc (zero_init_expr_p): If type is std::meta::info,
	return true iff t is null reflection.

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

Reviewed-by: Jason Merrill <jason@redhat.com>
3 files changed