<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Nov 12, 2015 at 8:29 AM, Vasileios Kalintiris <span dir="ltr"><<a href="mailto:Vasileios.Kalintiris@imgtec.com" target="_blank">Vasileios.Kalintiris@imgtec.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">




<div>
<div style="direction:ltr;font-family:'Courier New';color:rgb(0,0,0);font-size:10pt">
The test-case compiles fine with & without the base struct: <a href="https://goo.gl/gChBXX" target="_blank">
https://goo.gl/gChBXX</a></div></div></blockquote><div><br></div><div>Ah, seems it's the existence of a friend:<br><br></div><div>struct base {</div><div>  virtual void f2();</div><div>  // friend struct other;</div><div>protected:</div><div>  ~base() = default;</div><div>};</div><div><br></div><div>struct derived final : base { };</div><div> <br>Warning fires if the friend decl is uncommented.<br><br>I'm still not sure we want to abide by that behavior. If we do, we should consider implementing it in clang's version of the warning too... </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div><div style="direction:ltr;font-family:'Courier New';color:rgb(0,0,0);font-size:10pt"><br>
<br>
-Vasileios<br>
<div style="font-family:'Times New Roman';color:rgb(0,0,0);font-size:16px">
<hr>
<div style="direction:ltr"><font color="#000000" face="Tahoma" size="2"><b>From:</b> David Blaikie [<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>]<br>
<b>Sent:</b> 12 November 2015 16:21<br>
<b>To:</b> Vasileios Kalintiris<br>
<b>Cc:</b> <a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a><br>
<b>Subject:</b> Re: [llvm] r252537 - Fix -Wdeprecated warnings due to the use of copy ops on SCEVPredicate derived class objects<br>
</font><br>
</div><div><div class="h5">
<div></div>
<div>
<div dir="ltr"><br>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Thu, Nov 12, 2015 at 7:06 AM, Vasileios Kalintiris <span dir="ltr">
<<a href="mailto:Vasileios.Kalintiris@imgtec.com" target="_blank">Vasileios.Kalintiris@imgtec.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
Hi David,<br>
<br>
This introduced a "class has virtual functions and accessible non-virtual destructor" warning that is being printed a lot of times (g++ 5.2.1). Can you look at this?<br>
</blockquote>
<div><br>
</div>
<div>We should disable that warning on GCC. This API seems safe to me, no? The base class's dtor is protected (so external users can't polymorphically delete objects) and the derived classes have public non-virtual dtors, but are final (so no further classes
 can derived from them)<br>
<br>
This is not the only API that uses that pattern - oh, maybe it's the FoldingSetNode that's complicating this? Could you check if this produces the warning on GCC (is there a pastebin that runs that version of GCC so I can check this myself easily?)<br>
<br>
struct base {<br>
};<br>
<br>
struct middle: base {<br>
  virtual void func();<br>
protected:</div>
<div>  ~middle() = default;<br>
};</div>
<div><br>
</div>
<div>struct derived final : middle {<br>
};<br>
<br>
& then if you remove the base class, does the warning go away?<br>
<br>
- Dave</div>
<div> </div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<br>
Thanks,<br>
Vasileios<br>
<br>
[8/101] /usr/local/bin/g++   -DGTEST_HAS_RTTI=0 -D_DEBUG -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Ilib/Transforms/Utils -I/home/vk/repos/llvm/lib/Transforms/Utils -Iinclude -I/home/vk/r<br>
epos/llvm/include -fPIC -fvisibility-inlines-hidden -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wno-maybe-uninitialized -Wnon-virtual-dtor -Wno-comment -std<br>
=c++11 -g -fPIC   -gsplit-dwarf  -fno-exceptions -fno-rtti -MMD -MT lib/Transforms/Utils/CMakeFiles/LLVMTransformUtils.dir/SimplifyIndVar.cpp.o -MF lib/Transforms/Utils/CMakeFiles/LLVMTransformUtils.dir/SimplifyIndVar.cpp.o.d -o<br>
lib/Transforms/Utils/CMakeFiles/LLVMTransformUtils.dir/SimplifyIndVar.cpp.o -c /home/vk/repos/llvm/lib/Transforms/Utils/SimplifyIndVar.cpp<br>
In file included from /home/vk/repos/llvm/include/llvm/Analysis/ScalarEvolutionExpressions.h:19:0,<br>
                 from /home/vk/repos/llvm/lib/Transforms/Utils/SimplifyIndVar.cpp:22:<br>
/home/vk/repos/llvm/include/llvm/Analysis/ScalarEvolution.h:174:9: warning: ‘class llvm::SCEVPredicate’ has virtual functions and accessible non-virtual destructor [-Wnon-virtual-dtor]<br>
   class SCEVPredicate : public FoldingSetNode {<br>
         ^<br>
/home/vk/repos/llvm/include/llvm/Analysis/ScalarEvolution.h:244:9: warning: base class ‘class llvm::SCEVPredicate’ has accessible non-virtual destructor [-Wnon-virtual-dtor]<br>
<span>   class SCEVEqualPredicate final : public SCEVPredicate {<br>
</span>         ^<br>
/home/vk/repos/llvm/include/llvm/Analysis/ScalarEvolution.h:275:9: warning: base class ‘class llvm::SCEVPredicate’ has accessible non-virtual destructor [-Wnon-virtual-dtor]<br>
<span>   class SCEVUnionPredicate final : public SCEVPredicate {<br>
</span>         ^</blockquote>
</div>
<br>
</div>
</div>
</div>
</div></div></div>
</div>
</div>

</blockquote></div><br></div></div>