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

--- Comment #3 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-14 branch has been updated by Marek Polacek
<mpola...@gcc.gnu.org>:

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

commit r14-10235-gc27d6c7fd03f95483d372eae2c96912ceee98a5e
Author: Marek Polacek <pola...@redhat.com>
Date:   Wed May 8 17:02:49 2024 -0400

    c++: failure to suppress -Wsizeof-array-div in template [PR114983]

    -Wsizeof-array-div offers a way to suppress the warning by wrapping
    the second operand of the division in parens:

      sizeof (samplesBuffer) / (sizeof(unsigned char))

    but this doesn't work in a template, because we fail to propagate
    the suppression bits.  Do it, then.

    The finish_parenthesized_expr hunk is not needed because suppress_warning
    isn't very fine-grained.  But I think it makes sense to be explicit and
    not rely on OPT_Wparentheses also suppressing OPT_Wsizeof_array_div.

            PR c++/114983

    gcc/cp/ChangeLog:

            * pt.cc (tsubst_expr) <case SIZEOF_EXPR>: Use copy_warning.
            * semantics.cc (finish_parenthesized_expr): Also suppress
            -Wsizeof-array-div.

    gcc/testsuite/ChangeLog:

            * g++.dg/warn/Wsizeof-array-div3.C: New test.

    (cherry picked from commit 646db3d30bd071a1b671b4f91c9ea2ab7f2be21c)

Reply via email to