<< VD->getType());
DiagnoseUseOfDecl(Destructor, VD->getLocation());
+ if (Destructor->isTrivial()) return;
if (!VD->hasGlobalStorage()) return;
// Emit warning for non-trivial dtor in global scope (a real global,
Diag(VD->getLocation(), diag::warn_exit_time_destructor);
// TODO: this should be re-enabled for static locals by !CXAAtExit
- if (!Destructor->isTrivial() && !VD->isStaticLocal())
+ if (!VD->isStaticLocal())
Diag(VD->getLocation(), diag::warn_global_destructor);
}
-// RUN: %clang_cc1 -fsyntax-only -Wexit-time-destructors %s -verify
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -Wexit-time-destructors %s -verify
namespace test1 {
struct A { ~A(); };
static A &e = b[5];
static A &f = c[5][7];
}
+}
+
+namespace test3 {
+ struct A { ~A() = default; };
+ A a;
+
+ struct B { ~B(); };
+ struct C : B { ~C() = default; };
+ C c; // expected-warning {{exit-time destructor}}
+ class D {
+ friend struct E;
+ ~D() = default;
+ };
+ struct E : D {
+ D d;
+ ~E() = default;
+ };
+ E e;
}