Blame SOURCES/gcc44-rh750545.patch

f28b6a
2012-04-10  Jason Merrill  <jason@redhat.com>
f28b6a
f28b6a
	Red Hat BZ 750545
f28b6a
	* method.c (locate_dtor): Lazily declare the destructor.
f28b6a
f28b6a
--- gcc/cp/method.c
f28b6a
+++ gcc/cp/method.c
f28b6a
@@ -870,6 +870,8 @@ synthesize_exception_spec (tree type, tr
f28b6a
 tree
f28b6a
 locate_dtor (tree type, void *client ATTRIBUTE_UNUSED)
f28b6a
 {
f28b6a
+  if (CLASSTYPE_LAZY_DESTRUCTOR (type))
f28b6a
+    lazily_declare_fn (sfk_destructor, type);
f28b6a
   return CLASSTYPE_DESTRUCTORS (type);
f28b6a
 }
f28b6a
 
f28b6a
--- gcc/testsuite/g++.dg/eh/dtor3.C
f28b6a
+++ gcc/testsuite/g++.dg/eh/dtor3.C
f28b6a
@@ -0,0 +1,36 @@
f28b6a
+// Red Hat bug 750545
f28b6a
+// { dg-do run }
f28b6a
+
f28b6a
+class excep {};
f28b6a
+class A
f28b6a
+{
f28b6a
+public:
f28b6a
+  ~A() { throw excep(); }
f28b6a
+};
f28b6a
+
f28b6a
+class B
f28b6a
+{
f28b6a
+  A a;
f28b6a
+};
f28b6a
+
f28b6a
+class C
f28b6a
+{
f28b6a
+  B b;
f28b6a
+};
f28b6a
+
f28b6a
+void f()
f28b6a
+{
f28b6a
+  C* c = new C();
f28b6a
+
f28b6a
+  try
f28b6a
+  {
f28b6a
+    delete c;
f28b6a
+  }
f28b6a
+  catch(...)
f28b6a
+  {}
f28b6a
+}
f28b6a
+
f28b6a
+int main()
f28b6a
+{
f28b6a
+  f();
f28b6a
+}