PR c++/80059 - ICE with noexcept and __transaction_atomic
authorMarek Polacek <polacek@redhat.com>
Mon, 20 Mar 2017 15:02:09 +0000 (15:02 +0000)
committerMarek Polacek <mpolacek@gcc.gnu.org>
Mon, 20 Mar 2017 15:02:09 +0000 (15:02 +0000)
PR c++/80059 - ICE with noexcept and __transaction_atomic
* except.c (build_must_not_throw_expr): Call
instantiate_non_dependent_expr_sfinae.

* g++.dg/tm/pr80059-2.C: New test.
* g++.dg/tm/pr80059.C: New test.

Co-Authored-By: Paolo Carlini <paolo.carlini@oracle.com>
From-SVN: r246279

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

index 7ffd818bec6c75245129402180dc1fb572afba63..a356fc779242ee1dd6333bb4d69ed05461394f75 100644 (file)
@@ -1,3 +1,10 @@
+2017-03-20  Marek Polacek  <polacek@redhat.com>
+           Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/80059 - ICE with noexcept and __transaction_atomic
+       * except.c (build_must_not_throw_expr): Call
+       instantiate_non_dependent_expr_sfinae.
+
 2017-03-19  Jason Merrill  <jason@redhat.com>
 
        PR c++/80084 - wrong C++17 decomposition by reference of parameter.
index 45d00cc0fc904ab53deb82bf283c9c8a47fee2bf..f65b717c32b567dc365bbeb68e1d275fe3725a83 100644 (file)
@@ -271,6 +271,7 @@ build_must_not_throw_expr (tree body, tree cond)
       cond = perform_implicit_conversion_flags (boolean_type_node, cond,
                                                tf_warning_or_error,
                                                LOOKUP_NORMAL);
+      cond = instantiate_non_dependent_expr (cond);
       cond = cxx_constant_value (cond);
       if (integer_zerop (cond))
        return body;
index 2a767588727208d0cfb7fc39a53991c4e32ea3f5..abfaa5c2955b08db402f2eedae9698d1db6d375c 100644 (file)
@@ -1,3 +1,10 @@
+2017-03-20  Marek Polacek  <polacek@redhat.com>
+           Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/80059 - ICE with noexcept and __transaction_atomic
+       * g++.dg/tm/pr80059-2.C: New test.
+       * g++.dg/tm/pr80059.C: New test.
+
 2017-03-20  Martin Liska  <mliska@suse.cz>
 
        PR middle-end/79753
diff --git a/gcc/testsuite/g++.dg/tm/pr80059-2.C b/gcc/testsuite/g++.dg/tm/pr80059-2.C
new file mode 100644 (file)
index 0000000..10edb3a
--- /dev/null
@@ -0,0 +1,13 @@
+// PR c++/80059
+// { dg-do compile { target c++11 } }
+// { dg-options "-fgnu-tm" }
+
+template<typename T> int foo(T b)
+{
+  return __transaction_atomic noexcept(b) (0); // { dg-error "is not a constant expression" }
+}
+
+void bar()
+{
+  foo(true);
+}
diff --git a/gcc/testsuite/g++.dg/tm/pr80059.C b/gcc/testsuite/g++.dg/tm/pr80059.C
new file mode 100644 (file)
index 0000000..1b705b6
--- /dev/null
@@ -0,0 +1,13 @@
+// PR c++/80059
+// { dg-do compile { target c++11 } }
+// { dg-options "-fgnu-tm" }
+
+template<typename> int foo(bool b)
+{
+  return __transaction_atomic noexcept(b) (0); // { dg-error "is not a constant expression" }
+}
+
+void bar()
+{
+  foo<int>(true);
+}