* decl2.c (get_guard): Check DECL_FUNCTION_SCOPE_P.
From-SVN: r36567
This commit is contained in:
parent
99fada40ff
commit
401219a6c9
29
gcc/testsuite/g++.old-deja/g++.pt/static11.C
Normal file
29
gcc/testsuite/g++.old-deja/g++.pt/static11.C
Normal 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;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user