[Bug c++/71446] Incorrect overload resolution when using designated initializers

jakub at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Sat Mar 2 08:07:00 GMT 2019


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71446

--- Comment #17 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Author: jakub
Date: Sat Mar  2 08:06:57 2019
New Revision: 269340

URL: https://gcc.gnu.org/viewcvs?rev=269340&root=gcc&view=rev
Log:
        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.

Added:
    trunk/gcc/testsuite/g++.dg/cpp2a/desig10.C
    trunk/gcc/testsuite/g++.dg/cpp2a/desig11.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/call.c
    trunk/gcc/cp/cp-tree.h
    trunk/gcc/cp/decl.c
    trunk/gcc/cp/parser.c
    trunk/gcc/cp/pt.c
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/g++.dg/ext/desig4.C


More information about the Gcc-bugs mailing list