[cfe-users] Is there a way to make clang warn on this code?

Eric Christopher echristo at gmail.com
Fri Mar 14 17:15:12 PDT 2014


Adding Richard explicitly here. :)
On Mar 14, 2014 4:32 PM, "Quentin Colombet" <qcolombet at apple.com> wrote:

> Hi,
>
> I recently found a non-deterministic behavior in my application that was
> due to a missing field initialization.
> Here is a snippet of the actual problem:
>
> struct foo {
>   foo() {}; // <-- bar is not initialized here.
>   int getBar() const {
>     return bar; // <-- this returns an uninitialized value.
>   }
> private:
>   int bar;
> };
>
> I've compiled the attached cpp file that contains this snippet with -Wall
> -Wextra -Wuninitialized, but no warning is issued (trunk 203678).
> Is there an option to make clang warn about that?
>
> If not, should I file a PR?
>
> Thanks,
> -Quentin
>
>
> _______________________________________________
> cfe-users mailing list
> cfe-users at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-users/attachments/20140314/942ab047/attachment.html>


More information about the cfe-users mailing list