[Bug c++/19808] miss a warning about uninitialized member usage in member initializer list in constructor
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=19808 Anthony Brandon changed: What|Removed |Added Attachment #36706|0 |1 is obsolete|| --- Comment #29 from Anthony Brandon --- Created attachment 36851 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=36851&action=edit Updated patch for PR19808. I updated my patch to include a testcase, and I also fixed the case for anonymous unions. Things not working right (as far as i know) in this patch yet are: * references * pointers * multiple uninitialized values being used to initialize a single field. (I'm also not sure how to test for this in the testsuite)
[Bug c++/19808] miss a warning about uninitialized member usage in member initializer list in constructor
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=19808 --- Comment #27 from Anthony Brandon --- Created attachment 36706 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=36706&action=edit First version of patch for PR19808 This is the current version of my patch. It still needs some work. The Wuninitialized part should be combined with the Winit_self part, and it should be made to detect multiple uninitialized values in a single initializer.
[Bug c++/19808] miss a warning about uninitialized member usage in member initializer list in constructor
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=19808 --- Comment #25 from Anthony Brandon --- Never mind the second question, I found walk_tree.
[Bug c++/19808] miss a warning about uninitialized member usage in member initializer list in constructor
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=19808 Anthony Brandon changed: What|Removed |Added CC||anthony.brandon at gmail dot com --- Comment #24 from Anthony Brandon --- Hi, > It could be done specifically for uses in mem-initializers by walking the > initializer in perform_mem_init to look for any references to members that > haven't been marked yet. I've been working on this using this approach. At the moment I can detect and give a warning for something like: struct S { int i, j; S() : i(j), j(1) {} }; However it doesn't cover cases like i(j+1), and in the case of i(i) there would currently be two warnings (due to -Winit-self). Lastly, the warning is given like so: a.cpp:8:2: warning: ‘S::i’ is initialized with uninitialized field ‘S::j’ [-Wuninitialized] S() : i(j), j(b) {} ^ So I have a couple of questions: * How to get the right location for the mark. In other words: S() : i(j), j(b) {} ^ * Is there a function to traverse a tree structure looking for a particular tree (or some other way to get things like i(j+1) to work)? * Should this give a warning in the case of i(i)?