public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/100161] [10/11/12 Regression] Impossible to suppress Wtype-limits warning involving template parameter.
Date: Thu, 22 Apr 2021 21:37:18 +0000	[thread overview]
Message-ID: <bug-100161-4-vs8LPVK3AF@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-100161-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Marek Polacek <mpolacek@gcc.gnu.org>:

https://gcc.gnu.org/g:244dfb95119106e9267f37583caac565c39eb0ec

commit r12-71-g244dfb95119106e9267f37583caac565c39eb0ec
Author: Marek Polacek <polacek@redhat.com>
Date:   Tue Apr 20 20:24:09 2021 -0400

    c++: Prevent bogus -Wtype-limits warning with NTTP [PR100161]

    Recently, we made sure that we never call value_dependent_expression_p
    on an expression that isn't potential_constant_expression.  That caused
    this bogus warning with a non-type template parameter, something that
    users don't want to see.

    The problem is that in tsubst_copy_and_build/LE_EXPR 't' is "i < n",
    which, due to 'i', is not p_c_e, therefore we call t_d_e_p.  But the
    type of 'n' isn't dependent, so we think the whole 't' expression is
    not dependent.  It seems we need to test both op0 and op1 separately
    to suppress this warning.

    gcc/cp/ChangeLog:

            PR c++/100161
            * pt.c (tsubst_copy_and_build) <case PLUS_EXPR>: Test op0 and
            op1 separately for value- or type-dependence.

    gcc/testsuite/ChangeLog:

            PR c++/100161
            * g++.dg/warn/Wtype-limits6.C: New test.

  parent reply	other threads:[~2021-04-22 21:37 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-20 18:50 [Bug c++/100161] New: " yyc1992 at gmail dot com
2021-04-20 19:06 ` [Bug c++/100161] [10/11/12 Regression] " mpolacek at gcc dot gnu.org
2021-04-20 19:10 ` jakub at gcc dot gnu.org
2021-04-22 21:37 ` cvs-commit at gcc dot gnu.org [this message]
2021-04-22 21:38 ` [Bug c++/100161] [10/11 " mpolacek at gcc dot gnu.org
2021-04-27 16:41 ` cvs-commit at gcc dot gnu.org
2021-05-31 10:40 ` [Bug c++/100161] [10 " marxin at gcc dot gnu.org
2021-09-13 11:09 ` marxin at gcc dot gnu.org
2021-12-02 13:29 ` mpolacek at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-100161-4-vs8LPVK3AF@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).