[Bug c++/93383] ICE on accessing field of a structure which is non-type template parameter, -std=c++2a

cvs-commit at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Sat Apr 24 04:15:02 GMT 2021


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

--- Comment #13 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Patrick Palka <ppalka@gcc.gnu.org>:

https://gcc.gnu.org/g:bcd77b7b9f35bd5b559ed593c3b3e346c1e6f364

commit r12-100-gbcd77b7b9f35bd5b559ed593c3b3e346c1e6f364
Author: Patrick Palka <ppalka@redhat.com>
Date:   Sat Apr 24 00:14:29 2021 -0400

    c++: do_class_deduction and dependent init [PR93383]

    Here we're crashing during CTAD with a dependent initializer (performed
    from convert_template_argument) because one of the initializer's
    elements has an empty TREE_TYPE, which ends up making resolve_args
    unhappy.

    Besides the case where we're initializing one template placeholder
    from another, which is already specifically handled earlier in
    do_class_deduction, it seems we can't in general correctly resolve a
    template placeholder using a dependent initializer, so this patch makes
    the function just punt until instantiation time instead.

    gcc/cp/ChangeLog:

            PR c++/89565
            PR c++/93383
            PR c++/95291
            PR c++/99200
            PR c++/99683
            * pt.c (do_class_deduction): Punt if the initializer is
            type-dependent.

    gcc/testsuite/ChangeLog:

            PR c++/89565
            PR c++/93383
            PR c++/95291
            PR c++/99200
            PR c++/99683
            * g++.dg/cpp2a/nontype-class39.C: Remove dg-ice directive.
            * g++.dg/cpp2a/nontype-class45.C: New test.
            * g++.dg/cpp2a/nontype-class46.C: New test.
            * g++.dg/cpp2a/nontype-class47.C: New test.
            * g++.dg/cpp2a/nontype-class48.C: New test.


More information about the Gcc-bugs mailing list