================
Comment at: lib/AST/DeclCXX.cpp:944-945
@@ -940,2 +943,4 @@
SMKind |= SMF_Destructor;
- else if (D->isCopyAssignmentOperator())
+ data().HasIrrelevantDestructor =
+ D->isTrivial() && D->getAccess() == AS_public && !D->isDeleted();
+ } else if (D->isCopyAssignmentOperator())
----------------
Following the pattern elsewhere in this file, this should be:
if (D->isTrivial() && D->getAccess() == AS_public && !D->isDeleted())
data().HasIrrelevantDestructor = true;
I think this is also slightly more correct: in C++98, if a base class
destructor is explicitly-deleted or explicitly-defaulted but non-public (we
allow this as an extension), the derived class can still have a trivial,
public, non-deleted destructor, that is not irrelevant (because it calls a
non-irrelevant destructor, and in particular, any odr-use of the derived class
destructor is ill-formed).
================
Comment at: test/SemaCXX/warn-global-constructors.cpp:99
@@ -98,1 +98,3 @@
+namespace pr19253 {
+ struct A {
----------------
FWIW, I don't think this is the right fix for PR19253: we should be checking
whether the destructor is trivial, not whether it's irrelevant. But it makes
the 'irrelevant' flag be correct in more cases, so it's an improvement
regardless.
With r204825 fixed, I suspect your change may have no functional impact and
thus be untestable -- that's fine in this case, since 'hasIrrelevantDestructor'
is basically just an optimization.
http://llvm-reviews.chandlerc.com/D3190
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits