Add a warning when a non-POD class has an uninitialized field |
|
Issue descriptionThis is something that's come up a number of times: a new POD field is added, but not all the constructors initialize it. A simple heuristic which should hopefully work is: If a class is a non-POD, for each constructor, emit a warning for each POD field which does not have an initializer (either in-class or in the initializer list). I asked about putting a warning like this in clang, and support was lukewarm: in particular, there was concern that this warning would force pointless initialization of large arrays. For now, maybe we can prototype it as a plugin warning.
,
Mar 15 2018
Ah indeed: I found the internal bug, and found that there's issue 587624 for copy constructors as well. I'll keep this separate, since it's a slightly different, but I'll drop a link to this bug in that one as well. |
|
►
Sign in to add a comment |
|
Comment 1 by thakis@chromium.org
, Mar 15 2018