re PR c++/86201 (ICE: Error reporting routines re-entered)
authorMarek Polacek <polacek@redhat.com>
Tue, 3 Jul 2018 16:38:16 +0000 (16:38 +0000)
committerMarek Polacek <mpolacek@gcc.gnu.org>
Tue, 3 Jul 2018 16:38:16 +0000 (16:38 +0000)
PR c++/86201
* typeck.c (cp_build_binary_op): Check c_inhibit_evaluation_warnings.

* g++.dg/diagnostic/pr86201.C: New test.

From-SVN: r262353

gcc/cp/ChangeLog
gcc/cp/typeck.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/diagnostic/pr86201.C [new file with mode: 0644]

index de313ae2ff578fe37ced5cde4c6ada778b79c888..e4202e161babe4ace7dab75d0f7315b12079a8f1 100644 (file)
@@ -1,3 +1,8 @@
+2018-07-03  Marek Polacek  <polacek@redhat.com>
+
+       PR c++/86201
+       * typeck.c (cp_build_binary_op): Check c_inhibit_evaluation_warnings.
+
 2018-07-03  Jason Merrill  <jason@redhat.com>
 
        PR c++/86378 - functional cast in noexcept-specifier.
index 3a4f1cdf479284ed6dc72adf4a8a1a489d666a89..ea4ce9649cd7ff0366860f687a2afc80f874a2b3 100644 (file)
@@ -4734,6 +4734,7 @@ cp_build_binary_op (location_t location,
       if (code0 == VECTOR_TYPE && code1 == VECTOR_TYPE)
        goto vector_compare;
       if ((complain & tf_warning)
+         && c_inhibit_evaluation_warnings == 0
          && (FLOAT_TYPE_P (type0) || FLOAT_TYPE_P (type1)))
        warning (OPT_Wfloat_equal,
                 "comparing floating point with == or != is unsafe");
index 333096287be835a71934fb23d8c7ca83b613c60e..2afad58666b80dce1a4122fd61eab8b3cb392b78 100644 (file)
@@ -1,3 +1,8 @@
+2018-07-03  Marek Polacek  <polacek@redhat.com>
+
+       PR c++/86201
+       * g++.dg/diagnostic/pr86201.C: New test.
+
 2018-07-03  Richard Sandiford  <richard.sandiford@arm.com>
 
        PR tree-optimization/85694
diff --git a/gcc/testsuite/g++.dg/diagnostic/pr86201.C b/gcc/testsuite/g++.dg/diagnostic/pr86201.C
new file mode 100644 (file)
index 0000000..e7019c2
--- /dev/null
@@ -0,0 +1,12 @@
+// PR c++/86201
+// { dg-do compile { target c++11 } }
+
+template <class U, class V>
+auto fn1 (V&& v) -> decltype(U(v))
+{
+  return; // { dg-error "return-statement with no value" }
+}
+void fn2 ()
+{
+  fn1<bool>(1.0);
+}