-Wglobal-constructors: Don't warn on trivial defaulted dtors
Fixes PR19253. llvm-svn: 204825
This commit is contained in:
parent
e31dd3473e
commit
c511f43b67
|
@ -10470,7 +10470,7 @@ void Sema::FinalizeVarWithDestructor(VarDecl *VD, const RecordType *Record) {
|
|||
Diag(VD->getLocation(), diag::warn_exit_time_destructor);
|
||||
|
||||
// TODO: this should be re-enabled for static locals by !CXAAtExit
|
||||
if (!VD->isStaticLocal())
|
||||
if (!Destructor->isTrivial() && !VD->isStaticLocal())
|
||||
Diag(VD->getLocation(), diag::warn_global_destructor);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// RUN: %clang_cc1 -fsyntax-only -Wglobal-constructors %s -verify
|
||||
// RUN: %clang_cc1 -std=c++11 -fsyntax-only -Wglobal-constructors %s -verify
|
||||
|
||||
int opaque_int();
|
||||
|
||||
|
@ -101,3 +101,11 @@ namespace referencemember {
|
|||
int a;
|
||||
A b = { a };
|
||||
}
|
||||
|
||||
namespace pr19253 {
|
||||
struct A { ~A() = default; };
|
||||
A a;
|
||||
struct B { ~B() {} };
|
||||
struct C : B { ~C() = default; };
|
||||
C c; // expected-warning {{global destructor}}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue