[Bug c++/82110] Concept for default constructing works with new T, not with new T[1]

cvs-commit at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Sat Jul 10 02:43:39 GMT 2021


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

--- Comment #3 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:b9119edc09e4660d772dea771578715858f7fbdb

commit r12-2233-gb9119edc09e4660d772dea771578715858f7fbdb
Author: Patrick Palka <ppalka@redhat.com>
Date:   Fri Jul 9 22:40:07 2021 -0400

    c++: 'new T[N]' and SFINAE [PR82110]

    Here we're failing to treat 'new T[N]' as erroneous in a SFINAE context
    when T isn't default constructible because expand_aggr_init_1 doesn't
    communicate to build_aggr_init (its only SFINAE caller) whether the
    initialization was actually successful.  To fix this, this patch makes
    expand_aggr_init_1 and its subroutine expand_default_init return true on
    success, false on failure so that build_aggr_init can properly return
    error_mark_node on failure.

            PR c++/82110

    gcc/cp/ChangeLog:

            * init.c (build_aggr_init): Return error_mark_node if
            expand_aggr_init_1 returns false.
            (expand_default_init): Change return type to bool.  Return false
            on error, true on success.
            (expand_aggr_init_1): Likewise.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp0x/pr78765.C: Expect another conversion failure
            diagnostic.
            * g++.dg/template/sfinae14.C: Flip incorrect assertion.
            * g++.dg/cpp2a/concepts-requires27.C: New test.


More information about the Gcc-bugs mailing list