Member initialization list warning flag

Manuel López-Ibáñez
Mon Nov 9 23:40:00 GMT 2015

On 09/11/15 20:41, Zygmunt Ptak wrote:
> Hi,
> Is there any param in the gcc which will warn about not initialized
> class member from the initialization list?

Unfortunately, no. We do not even warn for:

struct S
     int i, j;
     S() : i(j), j(1) {}

This is and it should be not too difficult to fix, 
it just needs someone with enough time and perseverance to fix it. Anthony 
Brandon started working on it, but I'm not sure what is the status now. Of 
course, anyone is more than welcome to pick it up.

There is also, which is probably closer to what you 
want. The current patch 
( will warn even if 
the member is initialized within the constructor. But if this is what you want, 
you could try updating the patch to the latest trunk, complete it and submit it 
for approval.



More information about the Gcc-help mailing list