re PR c++/70266 (ICE on invalid code on x86_64-linux-gnu: unexpected expression ...
authorPaolo Carlini <paolo.carlini@oracle.com>
Sun, 5 Mar 2017 17:13:16 +0000 (17:13 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Sun, 5 Mar 2017 17:13:16 +0000 (17:13 +0000)
/cp
2017-03-05  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/70266
* except.c (build_must_not_throw_expr): Perform the implicit
conversions on the condition.

/testsuite
2017-03-05  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/70266
* g++.dg/tm/pr70266.C: New.

From-SVN: r245901

gcc/cp/ChangeLog
gcc/cp/except.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/tm/pr70266.C [new file with mode: 0644]

index b5587fdfab375d623409962ebf4dd2745d8427cd..3d7eae90a274024b97151c9a6232dba8fdb223ba 100644 (file)
@@ -1,3 +1,9 @@
+2017-03-05  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/70266
+       * except.c (build_must_not_throw_expr): Perform the implicit
+       conversions on the condition.
+
 2017-03-03  Jason Merrill  <jason@redhat.com>
 
        * mangle.c (mangle_decl): Check -Wnoexcept-type instead of
index bfc32908aece12af5321ce6bc90b927f8e9b46a2..45d00cc0fc904ab53deb82bf283c9c8a47fee2bf 100644 (file)
@@ -268,6 +268,9 @@ build_must_not_throw_expr (tree body, tree cond)
 
   if (cond && !value_dependent_expression_p (cond))
     {
+      cond = perform_implicit_conversion_flags (boolean_type_node, cond,
+                                               tf_warning_or_error,
+                                               LOOKUP_NORMAL);
       cond = cxx_constant_value (cond);
       if (integer_zerop (cond))
        return body;
index fcaacff3cc9ebcd51822f972bca1134a6e75e2e3..26bfb0ac170b3dad41196d67c556eb901ef59e4d 100644 (file)
@@ -1,3 +1,8 @@
+2017-03-05  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/70266
+       * g++.dg/tm/pr70266.C: New.
+
 2017-03-05  Andre Vehreschild  <vehre@gcc.gnu.org>
             Alessandro Fanfarillo  <fanfarillo.gcc@gmail.com>
 
diff --git a/gcc/testsuite/g++.dg/tm/pr70266.C b/gcc/testsuite/g++.dg/tm/pr70266.C
new file mode 100644 (file)
index 0000000..6f20afb
--- /dev/null
@@ -0,0 +1,8 @@
+// { dg-do compile { target c++11 } }
+// { dg-options "-fgnu-tm" }
+
+template < typename T > 
+int foo (int x, T t)
+{
+  return __transaction_atomic noexcept (foo) (1);  // { dg-error "cannot resolve" }
+}