Skip to content
Snippets Groups Projects
Commit d56af02f authored by Andrew Pinski's avatar Andrew Pinski
Browse files

Improve error message for excess elements in array initializer from {"a"}

So char arrays are not the only type that be initialized from {"a"}.
We can have wchar_t (L"") and char16_t (u"") types too. So let's
print out the type of the array instead of just saying char.

Note in the testsuite I used regex . to match '[' and ']' as
I could not figure out how many '\' I needed.

OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions.

gcc/c/ChangeLog:

	* c-typeck.cc (process_init_element): Print out array type
	for excessive elements.

gcc/testsuite/ChangeLog:

	* gcc.dg/init-bad-1.c: Update error message.
	* gcc.dg/init-bad-2.c: Likewise.
	* gcc.dg/init-bad-3.c: Likewise.
	* gcc.dg/init-excess-3.c: Likewise.
	* gcc.dg/pr61096-1.c: Likewise.
parent a6b810ae
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment