[Bug c++/100161] [10/11/12 Regression] Impossible to suppress Wtype-limits warning involving template parameter.

2021-04-22 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100161

--- Comment #3 from CVS Commits  ---
The master branch has been updated by Marek Polacek :

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

commit r12-71-g244dfb95119106e9267f37583caac565c39eb0ec
Author: Marek Polacek 
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) : Test op0 and
op1 separately for value- or type-dependence.

gcc/testsuite/ChangeLog:

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

[Bug c++/100161] [10/11/12 Regression] Impossible to suppress Wtype-limits warning involving template parameter.

2021-04-20 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100161

Jakub Jelinek  changed:

   What|Removed |Added

 CC||jakub at gcc dot gnu.org

--- Comment #2 from Jakub Jelinek  ---
Which has been backported to 10 branch in 
r10-8120-ge5613c55c2900cd23c9e78592f10258e19c74ab3

[Bug c++/100161] [10/11/12 Regression] Impossible to suppress Wtype-limits warning involving template parameter.

2021-04-20 Thread mpolacek at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100161

Marek Polacek  changed:

   What|Removed |Added

   Assignee|unassigned at gcc dot gnu.org  |mpolacek at gcc dot 
gnu.org
   Last reconfirmed||2021-04-20
   Priority|P3  |P2
Summary|Impossible to suppress  |[10/11/12 Regression]
   |Wtype-limits warning|Impossible to suppress
   |involving template  |Wtype-limits warning
   |parameter.  |involving template
   ||parameter.
 CC||mpolacek at gcc dot gnu.org
   Target Milestone|--- |10.4
 Status|UNCONFIRMED |ASSIGNED
 Ever confirmed|0   |1
   Keywords||diagnostic

--- Comment #1 from Marek Polacek  ---
Started with my r11-155.