https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123805
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed| |2026-01-24
Status|UNCONFIRMED |NEW
Ever confirmed|0 |1
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed.
I think the problem is here:
/* Must arrange to initialize each element of EXP
from elements of INIT. */
if (cv_qualified_p (type))
TREE_TYPE (exp) = cv_unqualified (type);
if (itype && cv_qualified_p (itype))
TREE_TYPE (init) = cv_unqualified (itype);
from_array = (itype && same_type_p (TREE_TYPE (init),
TREE_TYPE (exp)));
if (init && !BRACE_ENCLOSED_INITIALIZER_P (init)
&& (!from_array
|| (TREE_CODE (init) != CONSTRUCTOR
/* Can happen, eg, handling the compound-literals
extension (ext/complit12.C). */
&& TREE_CODE (init) != TARGET_EXPR)))
{
if (complain & tf_error)
error_at (init_loc, "array must be initialized "
"with a brace-enclosed initializer");
return error_mark_node;
}
from_array is true But in this case a can decay to a pointer type and void*
accepts all pointer types ...
So what I think needs to happen is the check on from_array needs to see if the
inner type for exp is void*.