r204825 - -Wglobal-constructors: Don't warn on trivial defaulted dtors

Stephan Tolksdorf st at quanttec.com
Wed Mar 26 16:07:01 PDT 2014


I'll update D3190 tomorrow and include Richard's test case.

- Stephan

Richard Smith wrote:
> On Wed, Mar 26, 2014 at 3:40 PM, Reid Kleckner <rnk at google.com
> <mailto:rnk at google.com>> wrote:
>
>     On Wed, Mar 26, 2014 at 3:10 PM, Richard Smith
>     <richard at metafoo.co.uk <mailto:richard at metafoo.co.uk>> wrote:
>
>         On Wed, Mar 26, 2014 at 9:36 AM, Stephan Tolksdorf
>         <st at quanttec.com <mailto:st at quanttec.com>> wrote:
>
>             Hi Reid,
>
>             Did you overlook that I had assigned PR19253 to myself and
>             posted a patch to this list (D3190)? :-)
>
>
>     Sorry, I was reading my inbox, not commit mail.  This looked super
>     obvious, so I went ahead.
>
>             I think that fixing HasIrrelevantDestructor (as I did in my
>             patch) would be a better solution for this issue.
>
>
>         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 :)
>
>         Another test case, should not warn (under either of the two
>         'global destructor' warnings):
>
>         class A {
>            friend struct B;
>            ~A() = default;
>         };
>         struct B {
>            ~B() = default;
>         } b;
>
>
>     Is B supposed to inherit from A here?
>
>
> It was supposed to, yes :)



More information about the cfe-commits mailing list