From 92377255c1a2591085f9cd87e4ddc4bd34ba17a5 Mon Sep 17 00:00:00 2001 From: Marek Polacek Date: Mon, 20 Mar 2017 15:02:09 +0000 Subject: [PATCH] PR c++/80059 - ICE with noexcept and __transaction_atomic 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 From-SVN: r246279 --- gcc/cp/ChangeLog | 7 +++++++ gcc/cp/except.c | 1 + gcc/testsuite/ChangeLog | 7 +++++++ gcc/testsuite/g++.dg/tm/pr80059-2.C | 13 +++++++++++++ gcc/testsuite/g++.dg/tm/pr80059.C | 13 +++++++++++++ 5 files changed, 41 insertions(+) create mode 100644 gcc/testsuite/g++.dg/tm/pr80059-2.C create mode 100644 gcc/testsuite/g++.dg/tm/pr80059.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 7ffd818bec6..a356fc77924 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,10 @@ +2017-03-20 Marek Polacek + Paolo Carlini + + 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 PR c++/80084 - wrong C++17 decomposition by reference of parameter. diff --git a/gcc/cp/except.c b/gcc/cp/except.c index 45d00cc0fc9..f65b717c32b 100644 --- a/gcc/cp/except.c +++ b/gcc/cp/except.c @@ -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; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 2a767588727..abfaa5c2955 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2017-03-20 Marek Polacek + Paolo Carlini + + 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 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 index 00000000000..10edb3a6de5 --- /dev/null +++ b/gcc/testsuite/g++.dg/tm/pr80059-2.C @@ -0,0 +1,13 @@ +// PR c++/80059 +// { dg-do compile { target c++11 } } +// { dg-options "-fgnu-tm" } + +template 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 index 00000000000..1b705b643c1 --- /dev/null +++ b/gcc/testsuite/g++.dg/tm/pr80059.C @@ -0,0 +1,13 @@ +// PR c++/80059 +// { dg-do compile { target c++11 } } +// { dg-options "-fgnu-tm" } + +template int foo(bool b) +{ + return __transaction_atomic noexcept(b) (0); // { dg-error "is not a constant expression" } +} + +void bar() +{ + foo(true); +} -- 2.30.2