[C++ PATCH] Harmonize C++ flexible array member initialization with C (PR c++/80135, PR c++/81922)

Jakub Jelinek jakub@redhat.com
Fri Dec 8 17:34:00 GMT 2017


On Fri, Dec 08, 2017 at 10:25:48AM -0700, Martin Sebor wrote:
> While testing the patch I noticed it issues some diagnostics
> multiple times.  It would be nice if the last (redundant)
> pedantic warning in the error case below could be avoided.

You mean completely drop the pedwarn "initialization of a flexible array member"
in all cases, because in theory we should have emitted already
"ISO C++ forbids flexible array member" pedwarn earlier?
I think it is better to pedwarn in both spots, the earlier pedwarn
might be disabled because of system headers or whatever else.

Or do you just mean to pedwarn only if we are not emitting the
"initialization of flexible array member in a nested context" error?
That is going to be harder, as that error is emitted in a different spot
(actually 2, because the STRING_CST vs. brace enclosed initializer is
separate), unlike the pedwarn is complain & tf_error guarded, etc.

	Jakub



More information about the Gcc-patches mailing list