<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Wed, Mar 26, 2014 at 9:36 AM, Stephan Tolksdorf <span dir="ltr"><<a href="mailto:st@quanttec.com" target="_blank">st@quanttec.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Reid,<br>
<br>
Did you overlook that I had assigned PR19253 to myself and posted a patch to this list (D3190)? :-)<br>
<br>
I think that fixing HasIrrelevantDestructor (as I did in my patch) would be a better solution for this issue.</blockquote><div><br></div><div>I agree that we should fix HasIrrelevantDestructor. But... we shouldn't warn on a trivial destructor no matter whether it's public or whether it calls non-public destructors. hasIrrelevantDestructor is supposed to just be an optimization, and shouldn't affect our semantics. => We want both fixes :)</div>
<div><br></div><div>Another test case, should not warn (under either of the two 'global destructor' warnings):</div><div><br></div><div>class A {</div><div> friend struct B;</div><div> ~A() = default;</div><div>
};</div><div>struct B {</div><div> ~B() = default;</div><div>} b;</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">
Reid Kleckner wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Author: rnk<br>
Date: Wed Mar 26 10:58:20 2014<br>
New Revision: 204825<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=204825&view=rev" target="_blank">http://llvm.org/viewvc/llvm-<u></u>project?rev=204825&view=rev</a><br>
Log:<br>
-Wglobal-constructors: Don't warn on trivial defaulted dtors<br>
<br>
Fixes PR19253.<br>
<br>
Modified:<br>
cfe/trunk/lib/Sema/<u></u>SemaDeclCXX.cpp<br>
cfe/trunk/test/SemaCXX/warn-<u></u>global-constructors.cpp<br>
<br>
Modified: cfe/trunk/lib/Sema/<u></u>SemaDeclCXX.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=204825&r1=204824&r2=204825&view=diff" target="_blank">http://llvm.org/viewvc/llvm-<u></u>project/cfe/trunk/lib/Sema/<u></u>SemaDeclCXX.cpp?rev=204825&r1=<u></u>204824&r2=204825&view=diff</a><br>
==============================<u></u>==============================<u></u>==================<br>
--- cfe/trunk/lib/Sema/<u></u>SemaDeclCXX.cpp (original)<br>
+++ cfe/trunk/lib/Sema/<u></u>SemaDeclCXX.cpp Wed Mar 26 10:58:20 2014<br>
@@ -10470,7 +10470,7 @@ void Sema::<u></u>FinalizeVarWithDestructor(Var<br>
Diag(VD->getLocation(), diag::warn_exit_time_<u></u>destructor);<br></blockquote></div></div></blockquote><div><br></div><div>This warning seems to have the same issue.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="HOEnZb"><div class="h5"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
// TODO: this should be re-enabled for static locals by !CXAAtExit<br>
- if (!VD->isStaticLocal())<br>
+ if (!Destructor->isTrivial() && !VD->isStaticLocal())<br>
Diag(VD->getLocation(), diag::warn_global_destructor);<br>
}<br>
<br>
<br>
Modified: cfe/trunk/test/SemaCXX/warn-<u></u>global-constructors.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/warn-global-constructors.cpp?rev=204825&r1=204824&r2=204825&view=diff" target="_blank">http://llvm.org/viewvc/llvm-<u></u>project/cfe/trunk/test/<u></u>SemaCXX/warn-global-<u></u>constructors.cpp?rev=204825&<u></u>r1=204824&r2=204825&view=diff</a><br>
==============================<u></u>==============================<u></u>==================<br>
--- cfe/trunk/test/SemaCXX/warn-<u></u>global-constructors.cpp (original)<br>
+++ cfe/trunk/test/SemaCXX/warn-<u></u>global-constructors.cpp Wed Mar 26 10:58:20 2014<br>
@@ -1,4 +1,4 @@<br>
-// RUN: %clang_cc1 -fsyntax-only -Wglobal-constructors %s -verify<br>
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -Wglobal-constructors %s -verify<br>
<br>
int opaque_int();<br>
<br>
@@ -101,3 +101,11 @@ namespace referencemember {<br>
int a;<br>
A b = { a };<br>
}<br>
+<br>
+namespace pr19253 {<br>
+ struct A { ~A() = default; };<br>
+ A a;<br>
+ struct B { ~B() {} };<br>
+ struct C : B { ~C() = default; };<br>
+ C c; // expected-warning {{global destructor}}<br>
+}<br>
<br>
<br>
______________________________<u></u>_________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@cs.uiuc.edu" target="_blank">cfe-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/<u></u>mailman/listinfo/cfe-commits</a><br>
<br>
</blockquote>
______________________________<u></u>_________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@cs.uiuc.edu" target="_blank">cfe-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/<u></u>mailman/listinfo/cfe-commits</a><br>
</div></div></blockquote></div><br></div></div>