method.c (synthesized_method_walk): Cleanups don't affect the EH spec either.
authorJason Merrill <jason@redhat.com>
Mon, 5 Mar 2012 18:07:12 +0000 (13:07 -0500)
committerJason Merrill <jason@gcc.gnu.org>
Mon, 5 Mar 2012 18:07:12 +0000 (13:07 -0500)
* method.c (synthesized_method_walk): Cleanups don't affect the EH
spec either.

From-SVN: r184945

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

index f837570b7adba34497b760d06e12668d5b67a638..71af797f77bed33c76800b51eb3c09d6bb43c004 100644 (file)
@@ -1,3 +1,8 @@
+2012-03-05  Jason Merrill  <jason@redhat.com>
+
+       * method.c (synthesized_method_walk): Cleanups don't affect the EH
+       spec either.
+
 2012-03-03  Jason Merrill  <jason@redhat.com>
 
        * init.c (perform_member_init): Cope with uninstantiated NSDMI.
index cf2a713aa2a8f3437370d9ee79e155c3ccdd4c60..07189168d1ffdafaa8589e3af3a81e3ce1256793 100644 (file)
@@ -1272,8 +1272,11 @@ synthesized_method_walk (tree ctype, special_function_kind sfk, bool const_p,
          rval = locate_fn_flags (base_binfo, complete_dtor_identifier,
                                  NULL_TREE, flags, complain);
          /* Note that we don't pass down trivial_p; the subobject
-            destructors don't affect triviality of the constructor.  */
-         process_subob_fn (rval, false, spec_p, NULL,
+            destructors don't affect triviality of the constructor.  Nor
+            do they affect constexpr-ness (a constant expression doesn't
+            throw) or exception-specification (a throw from one of the
+            dtors would be a double-fault).  */
+         process_subob_fn (rval, false, NULL, NULL,
                            deleted_p, NULL, NULL,
                            basetype);
        }
index 85a44107ce310d739259458d98065703501d40e6..5fbd14fcc8ca70fbe420e8d1d9b7511b1f29834a 100644 (file)
@@ -1,3 +1,7 @@
+2012-03-05  Jason Merrill  <jason@redhat.com>
+
+       * g++.dg/cpp0x/implicit13.C: New.
+
 2012-03-05  Jakub Jelinek  <jakub@redhat.com>
 
        PR tree-optimization/51721
diff --git a/gcc/testsuite/g++.dg/cpp0x/implicit13.C b/gcc/testsuite/g++.dg/cpp0x/implicit13.C
new file mode 100644 (file)
index 0000000..96bc770
--- /dev/null
@@ -0,0 +1,24 @@
+// Make sure that A's destructor doesn't affect constexpr
+// or exception-spec on D's default constructor.
+// { dg-do compile { target c++11 } }
+
+struct A {
+  constexpr A() noexcept: i(0) { }
+  int i;
+  ~A() noexcept(false);
+};
+
+struct B: A { };
+
+// Should get static initialization, so no constructor call.
+// { dg-final { scan-assembler-not "_ZN1BC1Ev" } }
+B b;
+
+struct C { C() noexcept; ~C(); };
+struct D: C { };
+extern D d;
+
+void *operator new(__SIZE_TYPE__, void*) noexcept;
+
+#define SA(X) static_assert((X),#X)
+SA(noexcept(new (&d) D));