On Wed, 19 Mar 2025, Jakub Jelinek wrote:

> Hi!
> 
> Even in C23/C2Y any initialization of flexible array member is still
> invalid, so we should emit a pedwarn on it.  But we no longer do for
> initialization with {}.  The reason is that for C17 and earlier,
> we already emitted a pedwarn on the {} initializer and so emitting
> another pedwarn on the flexible array member initialization would
> be diagnosing the same thing multiple times.
> 
> In C23 we no longer pedwarn on {}, it is standard.
> The following patch arranges a pedwarning for that for C23+, so that
> at least one pedwarning is emitted.
> 
> So that we don't "regress" from C17 to C23 on nested flexible array
> member initialization with no -pedantic/-pedantic-errors/-Wpedantic,
> the patch emits even the
> initialization of flexible array member in a nested context
> diagnostic as pedwarn in the {} case, after all, it doesn't cause
> much trouble, we just ignore it like before, it wouldn't initialize
> anything.
> 
> Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

OK.

-- 
Joseph S. Myers
josmy...@redhat.com

Reply via email to