]> git.ipfire.org Git - thirdparty/gcc.git/commit
c++: Fix -Wtype-limits in templates.
authorJason Merrill <jason@redhat.com>
Thu, 30 Jan 2020 18:12:05 +0000 (13:12 -0500)
committerJason Merrill <jason@redhat.com>
Thu, 30 Jan 2020 18:47:48 +0000 (13:47 -0500)
commit4dd468a042e19ef0fdbb1c53ca4060d4cb4972c5
tree7819466fed9b711211891322aea8d7dc4ff621a7
parent004ac7b780308dc899e565b887c7def0a6e100f2
c++: Fix -Wtype-limits in templates.

When instantiating a template tsubst_copy_and_build suppresses -Wtype-limits
warnings about e.g. == always being false because it might not always be
false for an instantiation with other template arguments.  But we should
warn if the operands don't depend on template arguments.

PR c++/82521
* pt.c (tsubst_copy_and_build) [EQ_EXPR]: Only suppress warnings if
the expression was dependent before substitution.
gcc/cp/ChangeLog
gcc/cp/pt.c
gcc/testsuite/g++.dg/warn/Wtype-limits3.C [new file with mode: 0644]