@@ -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_sfinae (cond, tf_none);
cond = cxx_constant_value (cond);
if (integer_zerop (cond))
return body;
@@ -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);
+}
@@ -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);
+}