]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/55652 (ICE (segfault) with templates and structs)
authorJakub Jelinek <jakub@redhat.com>
Thu, 13 Dec 2012 14:35:12 +0000 (15:35 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Thu, 13 Dec 2012 14:35:12 +0000 (15:35 +0100)
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.

From-SVN: r194479

gcc/cp/ChangeLog
gcc/cp/typeck2.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/noexcept19.C [new file with mode: 0644]

index a2228fad685fcdaf5e126d52997caba344650f4d..ea4cfb203426e9aeb717712359570639852fef19 100644 (file)
@@ -1,3 +1,9 @@
+2012-12-13  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c++/55652
+       * typeck2.c (merge_exception_specifiers): Don't call operand_equal_p
+       if noex is NULL.
+
 2012-12-11  Jason Merrill  <jason@redhat.com>
 
        PR c++/54883
index abddd4d11101323b3697ed1e7379b560b69233b3..fbf50004b60c7b4dedbcf4e8158b1b34a93c7198 100644 (file)
@@ -1871,7 +1871,7 @@ merge_exception_specifiers (tree list, tree add, tree fn)
       /* 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);
index a03406af0ad7502973d9f09c784f16f6c1a8590b..e16352a38122df8a28910facf340ea7616ed7565 100644 (file)
@@ -1,3 +1,8 @@
+2012-12-13  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c++/55652
+       * g++.dg/cpp0x/noexcept19.C: New test.
+
 2012-12-13  Richard Biener  <rguenther@suse.de>
 
        PR lto/55660
diff --git a/gcc/testsuite/g++.dg/cpp0x/noexcept19.C b/gcc/testsuite/g++.dg/cpp0x/noexcept19.C
new file mode 100644 (file)
index 0000000..12ff86e
--- /dev/null
@@ -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;