public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [C++ Patch] PR 70266
@ 2017-03-03 10:26 Paolo Carlini
  2017-03-03 11:36 ` Jason Merrill
  0 siblings, 1 reply; 2+ messages in thread
From: Paolo Carlini @ 2017-03-03 10:26 UTC (permalink / raw)
  To: gcc-patches; +Cc: Jason Merrill

[-- Attachment #1: Type: text/plain, Size: 455 bytes --]

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.

//////////////////////


[-- Attachment #2: CL_70266 --]
[-- Type: text/plain, Size: 276 bytes --]

/cp
2017-03-03  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-03  Paolo Carlini  <paolo.carlini@oracle.com>

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

[-- Attachment #3: patch_70266 --]
[-- Type: text/plain, Size: 924 bytes --]

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" }
+}

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [C++ Patch] PR 70266
  2017-03-03 10:26 [C++ Patch] PR 70266 Paolo Carlini
@ 2017-03-03 11:36 ` Jason Merrill
  0 siblings, 0 replies; 2+ messages in thread
From: Jason Merrill @ 2017-03-03 11:36 UTC (permalink / raw)
  To: Paolo Carlini; +Cc: gcc-patches

OK.

On Fri, Mar 3, 2017 at 12:26 AM, Paolo Carlini <paolo.carlini@oracle.com> wrote:
> 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.
>
> //////////////////////
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-03-03 11:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-03 10:26 [C++ Patch] PR 70266 Paolo Carlini
2017-03-03 11:36 ` Jason Merrill

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).