[cfe-dev] warn when ctor-initializer leaves uninitialized data?

Evan Wallace evan.exe at gmail.com
Mon Apr 9 16:26:36 PDT 2012

On Mon, Apr 9, 2012 at 3:54 PM, Jordan Rose <jediknil at belkadan.com> wrote:

> I like this idea, though like David said it might not be great for all
> projects. I think it should be off for POD structs, though, like your first
> example:
> > // warning about a
> > struct A { int a; };
> I think fewer people mistakenly expect POD structs to be initialized, and
> of course initializing 'a' would make the struct no-longer POD. The issues
> I've come across while working with Clang are always POD members in non-POD
> structures. What do you think?

That makes a lot of sense, especially for compiling C-like code. I like
that much better. I've updated my patch with test cases and a check for POD
types. I'm still not sure where to put this diagnostic. It's tentatively in
a new warning called -Wuninitialized-member in the -Wextra group. Is that
the best place for it, or would it fit better somewhere else?

- Evan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20120409/256172c8/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Wuninitialized-member.diff
Type: application/octet-stream
Size: 4214 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20120409/256172c8/attachment.obj>

More information about the cfe-dev mailing list