Properly implement C++0x [stmt.dcl]p3, which requires a scope to be
protected in the case where a variable is being initialized by a
trivial default constructor but has a non-trivial destructor.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133037 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/JumpDiagnostics.cpp b/lib/Sema/JumpDiagnostics.cpp
index ae154aa..679f4fe 100644
--- a/lib/Sema/JumpDiagnostics.cpp
+++ b/lib/Sema/JumpDiagnostics.cpp
@@ -157,6 +157,9 @@
: Record->isPOD()) &&
Constructor->isDefaultConstructor())
CallsTrivialConstructor = true;
+
+ if (CallsTrivialConstructor && !Record->hasTrivialDestructor())
+ InDiag = diag::note_protected_by_variable_nontriv_destructor;
}
if (!CallsTrivialConstructor)