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

--- Comment #4 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Joseph Myers <js...@gcc.gnu.org>:

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

commit r15-5532-gd5cebf7e4491ea0306a072ca3368d771a5ff9455
Author: Joseph Myers <josmy...@redhat.com>
Date:   Wed Nov 20 21:29:48 2024 +0000

    c: Diagnose compound literal for empty array [PR114266]

    As reported in bug 114266, GCC fails to pedwarn for a compound
    literal, whose type is an array of unknown size, initialized with an
    empty initializer.  This case is disallowed by C23 (which doesn't have
    zero-size objects); the case of a named object is diagnosed as
    expected, but not that for compound literals.  (Before C23, the
    pedwarn for empty initializers sufficed.)  Add a check for this
    specific case with a pedwarn.

    Bootstrapped with no regressions for x86_64-pc-linux-gnu.

            PR c/114266

    gcc/c/
            * c-decl.cc (build_compound_literal): Diagnose array of unknown
            size with empty initializer for C23.

    gcc/testsuite/
            * gcc.dg/c23-empty-init-4.c: New test.

Reply via email to