From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 3F268399A434; Tue, 27 Apr 2021 16:41:47 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3F268399A434 From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/100161] [10/11 Regression] Impossible to suppress Wtype-limits warning involving template parameter. Date: Tue, 27 Apr 2021 16:41:46 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 10.2.0 X-Bugzilla-Keywords: diagnostic X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: mpolacek at gcc dot gnu.org X-Bugzilla-Target-Milestone: 10.4 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Apr 2021 16:41:47 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D100161 --- Comment #5 from CVS Commits --- The releases/gcc-11 branch has been updated by Marek Polacek : https://gcc.gnu.org/g:fb7c736c2f17ad054ee7815b688fa91135690f6d commit r11-8306-gfb7c736c2f17ad054ee7815b688fa91135690f6d 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. (cherry picked from commit 244dfb95119106e9267f37583caac565c39eb0ec)=