diff options
author | Jason Merrill <jason@gcc.gnu.org> | 2000-09-21 18:05:48 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2000-09-21 18:05:48 -0400 |
commit | 401219a6c93d1ba14cee07ed0ab7935f04072358 (patch) | |
tree | dabfb8f21724c780e36bc74ce49ed00a9d901dc3 /gcc | |
parent | 99fada40ffa1fb0b899e7a636a993006165b8803 (diff) | |
download | gcc-401219a6c93d1ba14cee07ed0ab7935f04072358.zip gcc-401219a6c93d1ba14cee07ed0ab7935f04072358.tar.gz gcc-401219a6c93d1ba14cee07ed0ab7935f04072358.tar.bz2 |
* decl2.c (get_guard): Check DECL_FUNCTION_SCOPE_P.
From-SVN: r36567
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/testsuite/g++.old-deja/g++.pt/static11.C | 29 |
1 files changed, 29 insertions, 0 deletions
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 index 0000000..07e6fd7 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/static11.C @@ -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; +} |