<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Mar 5, 2015 at 10:01 PM, Nico Weber <span dir="ltr"><<a href="mailto:nicolasweber@gmx.de" target="_blank">nicolasweber@gmx.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: nico<br>
Date: Fri Mar  6 00:01:06 2015<br>
New Revision: 231451<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=231451&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=231451&view=rev</a><br>
Log:<br>
Don't crash on non-public referenced dtors in toplevel classes.<br>
<br>
Fixes PR22793, a bug that caused self-hosting to fail after the innocuous<br>
r231254. See the bug for details.<br></blockquote><div><br>Awesome - thanks for jumping on this! <br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Modified:<br>
    cfe/trunk/lib/Sema/SemaExpr.cpp<br>
    cfe/trunk/test/CodeGenCXX/trivial-constructor-init.cpp<br>
<br>
Modified: cfe/trunk/lib/Sema/SemaExpr.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=231451&r1=231450&r2=231451&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=231451&r1=231450&r2=231451&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)<br>
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Fri Mar  6 00:01:06 2015<br>
@@ -117,7 +117,7 @@ static AvailabilityResult DiagnoseAvaila<br>
     case AR_Available:<br>
     case AR_NotYetIntroduced:<br>
       break;<br>
-<br>
+<br>
     case AR_Deprecated:<br>
       if (S.getCurContextAvailability() != AR_Deprecated)<br>
         S.EmitAvailabilityWarning(Sema::AD_Deprecation,<br>
@@ -11859,8 +11859,11 @@ void Sema::MarkFunctionReferenced(Source<br>
   } else if (CXXDestructorDecl *Destructor =<br>
                  dyn_cast<CXXDestructorDecl>(Func)) {<br>
     Destructor = cast<CXXDestructorDecl>(Destructor->getFirstDecl());<br>
-    if (Destructor->isDefaulted() && !Destructor->isDeleted())<br>
+    if (Destructor->isDefaulted() && !Destructor->isDeleted()) {<br>
+      if (Destructor->isTrivial() && !Destructor->hasAttr<DLLExportAttr>())<br>
+        return;<br>
       DefineImplicitDestructor(Loc, Destructor);<br>
+    }<br>
     if (Destructor->isVirtual() && getLangOpts().AppleKext)<br>
       MarkVTableUsed(Loc, Destructor->getParent());<br>
   } else if (CXXMethodDecl *MethodDecl = dyn_cast<CXXMethodDecl>(Func)) {<br>
<br>
Modified: cfe/trunk/test/CodeGenCXX/trivial-constructor-init.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/trivial-constructor-init.cpp?rev=231451&r1=231450&r2=231451&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/trivial-constructor-init.cpp?rev=231451&r1=231450&r2=231451&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/test/CodeGenCXX/trivial-constructor-init.cpp (original)<br>
+++ cfe/trunk/test/CodeGenCXX/trivial-constructor-init.cpp Fri Mar  6 00:01:06 2015<br>
@@ -32,3 +32,17 @@ static C c[4];<br>
<br>
 int main() {<br>
 }<br>
+<br>
+namespace PR22793 {<br>
+template <typename><br>
+struct foo {<br>
+protected:<br></blockquote><div><br>Naively, I was hoping a/the fix might resolve around this being protected. I was sort of hoping that the fix might involve /removing/ code that was needlessly checking access rather than adding more conditions. Seems strange that the access level could change the behavior of this code. (but I haven't fully understood the notes you made on the bug - so I imagine it's probably described in there somewhere) Any chance of that?<br><br>- David<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+// CHECK-NOT: _ZN7PR227933fooIiED2Ev<br>
+  ~foo() = default;<br>
+  friend void func();<br>
+};<br>
+<br>
+void func() { foo<int> f; }<br>
+<br>
+template struct foo<int>;<br>
+}<br>
<br>
<br>
_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@cs.uiuc.edu">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/mailman/listinfo/cfe-commits</a><br>
</blockquote></div><br></div></div>