Hi,
one more case of OVERLOAD filtering to cxx_eval_constant_expression and
causing an ICE.
In order to have a proper diagnostic early enough I think that in
build_must_not_throw_expr we want to use
perform_implicit_conversion_flags on the condition before calling
cxx_constant_value for it. That would be also analogous to the code we
already have in build_noexcept_spec, for example. Tested x86_64-linux.
Thanks, Paolo.
//////////////////////
/cp
2017-03-03 Paolo Carlini <paolo.carl...@oracle.com>
PR c++/70266
* except.c (build_must_not_throw_expr): Perform the implicit
conversions on the condition.
/testsuite
2017-03-03 Paolo Carlini <paolo.carl...@oracle.com>
PR c++/70266
* g++.dg/tm/pr70266.C: New.
Index: cp/except.c
===================================================================
--- cp/except.c (revision 245836)
+++ cp/except.c (working copy)
@@ -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: testsuite/g++.dg/tm/pr70266.C
===================================================================
--- testsuite/g++.dg/tm/pr70266.C (revision 0)
+++ testsuite/g++.dg/tm/pr70266.C (working copy)
@@ -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" }
+}