Blame SOURCES/gcc44-rh750545.patch

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