c++: Don't allow designated initializers with non-aggregates [PR95369]
Another part of 95369 is that we accept designated initializers with
non-aggregate types. That seems to be wrong since they're part of
aggregate initialization. clang/icc also reject it.
There are multiple contexts where we can use designated initializers:
function-like casts, member list initializers, NTTP, etc. I've adjusted
add_list_candidates and implicit_conversion_error in order to to detect
this case.
gcc/cp/ChangeLog:
PR c++/95369
* call.c (add_list_candidates): Return if a designated initializer
is used with a non-aggregate.
(implicit_conversion_error): Give an error for the case above.
gcc/testsuite/ChangeLog:
PR c++/95369
* g++.dg/cpp2a/desig11.C: Adjust dg-error.
* g++.dg/cpp2a/desig16.C: New test.