<div>   case CXXTemporaryObjectExprClass:</div><div>-  case CXXConstructExprClass:</div><div>+  case CXXConstructExprClass: {</div><div>+    QualType Ty = getType();</div><div>+    if (const TagType *TT = Ty->getAs<TagType>()) {</div>
<div>+      const TagDecl *Tag = TT->getDecl();</div><div><br></div><div>You can use getType()->getAsCXXRecordDecl() here. Otherwise, looks fine, thanks.</div><br><div class="gmail_quote">On Sat, Jul 20, 2013 at 4:24 PM, Lubos Lunak <span dir="ltr"><<a href="mailto:l.lunak@suse.cz" target="_blank">l.lunak@suse.cz</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On Tuesday 16 of July 2013, Lubos Lunak wrote:<br>
> On Tuesday 16 of July 2013, Lubos Lunak wrote:<br>
> > On Tuesday 16 of July 2013, Richard Smith wrote:<br>
> > > On Tue, Jul 16, 2013 at 12:50 PM, Lubos Lunak <<a href="mailto:l.lunak@suse.cz">l.lunak@suse.cz</a>> wrote:<br>
> > > > On Tuesday 16 of July 2013, Richard Smith wrote:<br>
> > > > > Consider:<br>
> > > > ><br>
> > > > > {<br>
> > > > >   my_lock(my_mutex); // A<br>
> > > > >   my_lock ml(my_mutex); // B<br>
> > > > >   my_string("foo"); // C<br>
> > > > >   my_string ms("foo"); // D<br>
> > > > > }<br>
> > > > ><br>
> > > > > We never warn for a class that is in category (1). my_lock would be<br>
> > > > > in category (2), so we warn on A but not B. my_string would be in<br>
> > > > > category (3), so we warn on both C and D.<br>
> > > > ><br>
> > > > > Which of these does the warn_unused attribute model?<br>
> > > ><br>
> > > >  It doesn't model anything. It prevents disabling of the<br>
> > > > unused-variable warning for whatever type that has the attribute.<br>
> > ><br>
> > > So which of the above behaviors do you get? (Or do you get something<br>
> > > else?)<br>
> ><br>
> >  I think you are talking about something slightly different. This is<br>
> > about the (-W)unused-variable warning. So A and C obviously don't apply.<br>
><br>
>  But since you ask, without looking at the code, presumably<br>
> (-W)unused-result has code similar to unused-variable that also disables<br>
> the warning if the type in question has non-trivial ctor/dtor, so you could<br>
> do a similar modification there to enable the warning for types with<br>
> warn_unused attribute.<br>
<br>
</div></div> The attached patch adds this functionality for the -Wunused-value warning.<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
 Lubos Lunak<br>
 <a href="mailto:l.lunak@suse.cz">l.lunak@suse.cz</a><br>
</font></span></blockquote></div><br>