* decl2.c (get_guard): Check DECL_FUNCTION_SCOPE_P.

From-SVN: r36567
This commit is contained in:
Jason Merrill 2000-09-21 18:05:48 -04:00
parent 99fada40ff
commit 401219a6c9

View File

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