+2020-01-29 Jason Merrill <jason@redhat.com>
+
+ PR c++/82521
+ * pt.c (tsubst_copy_and_build) [EQ_EXPR]: Only suppress warnings if
+ the expression was dependent before substitution.
+
2020-01-30 Bin Cheng <bin.cheng@linux.alibaba.com>
* coroutines.cc (act_des_fn): New.
case MEMBER_REF:
case DOTSTAR_EXPR:
{
- warning_sentinel s1(warn_type_limits);
- warning_sentinel s2(warn_div_by_zero);
- warning_sentinel s3(warn_logical_op);
- warning_sentinel s4(warn_tautological_compare);
+ /* If T was type-dependent, suppress warnings that depend on the range
+ of the types involved. */
+ bool was_dep = uses_template_parms (t);
+ warning_sentinel s1(warn_type_limits, was_dep);
+ warning_sentinel s2(warn_div_by_zero, was_dep);
+ warning_sentinel s3(warn_logical_op, was_dep);
+ warning_sentinel s4(warn_tautological_compare, was_dep);
+
tree op0 = RECUR (TREE_OPERAND (t, 0));
tree op1 = RECUR (TREE_OPERAND (t, 1));
tree r = build_x_binary_op
--- /dev/null
+// PR c++/82521
+// { dg-additional-options "-Wtype-limits" }
+
+template <typename T>
+const char * g(const unsigned char value)
+{
+ return value == -1 ? "-1" : "no"; // { dg-warning "always false" }
+}
+
+int main()
+{
+ g<int>(-1);
+}