re PR c++/71446 (Incorrect overload resolution when using designated initializers)
authorJakub Jelinek <jakub@redhat.com>
Sat, 2 Mar 2019 08:06:57 +0000 (09:06 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Sat, 2 Mar 2019 08:06:57 +0000 (09:06 +0100)
commit574eaf0fda98b795daf6b588e3c0e878987f9769
tree999a0ff1961dfb213965506f95467552114d19cb
parent73ba6c712005892fbddb3e4dd7160d218e1b8c50
re PR c++/71446 (Incorrect overload resolution when using designated initializers)

PR c++/71446
* cp-tree.h (CONSTRUCTOR_IS_DESIGNATED_INIT): Define.
* parser.c (cp_parser_braced_list): Adjust cp_parser_initializer_list
caller, set CONSTRUCTOR_IS_DESIGNATED_INIT.
(cp_parser_initializer_list): Add designated parameter, set *designated
to a bool whether any designators were parsed.
* decl.c (reshape_init): Copy over CONSTRUCTOR_IS_DESIGNATED_INIT if
needed.
* pt.c (tsubst_copy_and_build): Likewise.
* call.c (implicit_conversion): If CONSTRUCTOR_IS_DESIGNATED_INIT,
don't call build_list_conv, nor build_complex_conv, nor attempt to
convert a single element initializer to scalar.

* g++.dg/cpp2a/desig10.C: New test.
* g++.dg/cpp2a/desig11.C: New test.
* g++.dg/ext/desig4.C: Expect 4 new errors.

From-SVN: r269340
gcc/cp/ChangeLog
gcc/cp/call.c
gcc/cp/cp-tree.h
gcc/cp/decl.c
gcc/cp/parser.c
gcc/cp/pt.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp2a/desig10.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp2a/desig11.C [new file with mode: 0644]
gcc/testsuite/g++.dg/ext/desig4.C