OSDN Git Service

* decl2.c (get_guard): Check DECL_FUNCTION_SCOPE_P.
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 21 Sep 2000 22:05:48 +0000 (22:05 +0000)
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 21 Sep 2000 22:05:48 +0000 (22:05 +0000)
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@36567 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/testsuite/g++.old-deja/g++.pt/static11.C [new file with mode: 0644]

diff --git a/gcc/testsuite/g++.old-deja/g++.pt/static11.C b/gcc/testsuite/g++.old-deja/g++.pt/static11.C
new file mode 100644 (file)
index 0000000..07e6fd7
--- /dev/null
@@ -0,0 +1,29 @@
+// Bug: g++ was failing to destroy C<int>::a because it was using two
+// different sentry variables for construction and destruction.
+
+extern "C" void _exit (int);
+
+int r = 1;
+
+struct A
+{
+  void f(){};
+  A(){ ++r; }
+  ~A(){ r -= 2; _exit (r); }
+};
+
+template<class T>
+struct C
+{
+  C(){ a.f(); }
+  static A a;
+};
+
+template <class T> A C<T>::a;
+typedef C<int> B;
+
+int main()
+{
+  C<int> c;
+  return r;
+}