public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [C++ PATCH] Fix ICE in merge_exception_specifiers (PR c++/55652)
@ 2012-12-12 19:42 Jakub Jelinek
  2012-12-13 14:30 ` Jason Merrill
  0 siblings, 1 reply; 2+ messages in thread
From: Jakub Jelinek @ 2012-12-12 19:42 UTC (permalink / raw)
  To: Jason Merrill; +Cc: gcc-patches

Hi!

This is a follow-up fix for my earlier commit, in merge_exception_specifiers
can be NULL, noex == boolean_true_node comparison then was false, but
operand_equal_p crashes on it.

Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for
trunk?

2012-12-12  Jakub Jelinek  <jakub@redhat.com>

	PR c++/55652
	* typeck2.c (merge_exception_specifiers): Don't call operand_equal_p
	if noex is NULL.

	* g++.dg/cpp0x/noexcept19.C: New test.

--- gcc/cp/typeck2.c.jj	2012-12-06 19:54:56.000000000 +0100
+++ gcc/cp/typeck2.c	2012-12-12 10:12:33.468377515 +0100
@@ -1871,7 +1871,7 @@ merge_exception_specifiers (tree list, t
       /* If ADD is a deferred noexcept, we must have been called from
 	 process_subob_fn.  For implicitly declared functions, we build up
 	 a list of functions to consider at instantiation time.  */
-      if (operand_equal_p (noex, boolean_true_node, 0))
+      if (noex && operand_equal_p (noex, boolean_true_node, 0))
 	noex = NULL_TREE;
       gcc_assert (fn && (!noex || is_overloaded_fn (noex)));
       noex = build_overload (fn, noex);
--- gcc/testsuite/g++.dg/cpp0x/noexcept19.C.jj	2012-12-12 10:11:20.182816929 +0100
+++ gcc/testsuite/g++.dg/cpp0x/noexcept19.C	2012-12-12 10:10:50.000000000 +0100
@@ -0,0 +1,29 @@
+// PR c++/55652
+// { dg-do compile }
+// { dg-options "-std=c++11" }
+
+template <typename T>
+struct A
+{
+  static const bool a = false;
+};
+
+template <typename X, typename Y = A <X>>
+struct B
+{
+  B () noexcept (A <Y>::a) {}
+};
+
+template <typename X, typename Y>
+struct C
+{
+  X x;
+  Y y;
+};
+
+struct D
+{
+  D () throw (int);
+};
+
+C <D, B <D>> c;

	Jakub

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

* Re: [C++ PATCH] Fix ICE in merge_exception_specifiers (PR c++/55652)
  2012-12-12 19:42 [C++ PATCH] Fix ICE in merge_exception_specifiers (PR c++/55652) Jakub Jelinek
@ 2012-12-13 14:30 ` Jason Merrill
  0 siblings, 0 replies; 2+ messages in thread
From: Jason Merrill @ 2012-12-13 14:30 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: gcc-patches

OK.

Jason

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

end of thread, other threads:[~2012-12-13 14:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-12-12 19:42 [C++ PATCH] Fix ICE in merge_exception_specifiers (PR c++/55652) Jakub Jelinek
2012-12-13 14:30 ` 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).