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

--- Comment #6 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <ja...@gcc.gnu.org>:

https://gcc.gnu.org/g:64828272cde415bf2d7222eec87147ba84980f3d

commit r15-6908-g64828272cde415bf2d7222eec87147ba84980f3d
Author: Jakub Jelinek <ja...@redhat.com>
Date:   Wed Jan 15 08:53:13 2025 +0100

    c++: Fix up maybe_init_list_as_array for RAW_DATA_CST [PR118124]

    The previous patch made me look around some more and I found
    maybe_init_list_as_array doesn't handle RAW_DATA_CSTs correctly either,
    while the RAW_DATA_CST is properly split during finish_compound_literal,
    it was using CONSTRUCTOR_NELTS as the size of the arrays, which is wrong,
    RAW_DATA_CST could stand for far more initializers.

    2025-01-15  Jakub Jelinek  <ja...@redhat.com>

            PR c++/118124
            * cp-tree.h (build_array_of_n_type): Change second argument type
            from int to unsigned HOST_WIDE_INT.
            * tree.cc (build_array_of_n_type): Likewise.
            * call.cc (count_ctor_elements): New function.
            (maybe_init_list_as_array): Use it instead of CONSTRUCTOR_NELTS.
            (convert_like_internal): Use length from init's type instead of
            len when handling the maybe_init_list_as_array case.

            * g++.dg/cpp0x/initlist-opt5.C: New test.

Reply via email to