[cfe-dev] warn_unused_result attribute on class definition not applying to methods declared in that class

Craig Topper via cfe-dev cfe-dev at lists.llvm.org
Mon Apr 17 23:48:12 PDT 2017


It seems if warn_unused_result is put on a class definition it doesn't
apply to any of the methods in that class that return the class type?

This test should generate 2 warnings but only generates one.

https://godbolt.org/g/kImv9k

The ArrayRef and APInt classes both do this. I accidentally created a case
where I didn't consume the result of APInt::trunc and received no warning.

~Craig
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20170417/f7d85d43/attachment.html>


More information about the cfe-dev mailing list