unless we're on a platform without __cxa_atexit (or use thereof has been
disabled). This patch actually just disables the check completely for
static locals, but I've filed http://llvm.org/bugs/show_bug.cgi?id=8176 to
track the platform-specific fix.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@114269
91177308-0d34-0410-b5e6-
96231b3b80d8
<< VD->getDeclName()
<< VD->getType());
- if (!VD->isInvalidDecl() && VD->hasGlobalStorage())
+ // TODO: this should be re-enabled for static locals by !CXAAtExit
+ if (!VD->isInvalidDecl() && VD->hasGlobalStorage() && !VD->isStaticLocal())
Diag(VD->getLocation(), diag::warn_global_destructor);
}
}
struct A { ~A(); };
void f1() {
- static A a; // expected-warning {{global destructor}}
+ static A a;
}
void f2() {
static A& a = *new A;
int x;
Foo(int x1) : x(x1) {}
};
+ void foo() {
+ static Foo a(0);
+ }
+ struct Bar {
+ ~Bar();
+ };
void bar() {
- static Foo a(0);
+ static Bar b;
}
}