* decl2.c (get_guard): Check DECL_FUNCTION_SCOPE_P.
authorJason Merrill <jason@gcc.gnu.org>
Thu, 21 Sep 2000 22:05:48 +0000 (18:05 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Thu, 21 Sep 2000 22:05:48 +0000 (18:05 -0400)
From-SVN: r36567

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;
+}