C++: Add cpp/uninitialized-local test#20407
Conversation
9d1dde7 to
2bc035c
Compare
|
|
||
| too_many_constants_init(s); | ||
|
|
||
| return m; |
There was a problem hiding this comment.
Should we have an annotation here?
| return m; | |
| return m; // BAD -- m has not been initialized |
There was a problem hiding this comment.
It's GOOD actually. The initialization happens in the omitted too_many_constants_init.
| S s[] = { | ||
| {.a = 0, .c = 0, .d = nullptr, .r = {.n = {.e = e, .f = 1, .g = nullptr, .h = h, .i = i, .j = false, .k = k, .l = l, .m = &m}}}, | ||
| {.a = 0, .c = 0, .d = nullptr, .r = {.q = {.o = true, .p = true}}} | ||
| }; |
There was a problem hiding this comment.
I think it would be nice with a small comment explaining what the interesting thing being tested here is. Something with too many constants? :)
There was a problem hiding this comment.
Nothing anymore, after the extractor fix I merged yesterday. This test is just here to make sure we do not regress.
There was a problem hiding this comment.
Then is is testing something interesting right? That we don't regress for some specific case. I'm suggesting it would be nice to write out what the special thing about this case here is. Is it the number of fields, the nesting, etc? It's not clear to me :)
There was a problem hiding this comment.
I'm going to politely refuse, because this is related to internal extractor details. If you want the full story, please follow the link to the internal PR that references this PR.
There was a problem hiding this comment.
To be clear, I'm not suggesting writing anything about the extractor, but that we highlight the interesting/key aspect of the test. I've suggested a comment below.
| {.a = 0, .c = 0, .d = nullptr, .r = {.q = {.o = true, .p = true}}} | ||
| }; | ||
|
|
||
| too_many_constants_init(s); |
There was a problem hiding this comment.
| too_many_constants_init(s); | |
| too_many_constants_init(s); // Initializer being passed a literal with many constants |
There was a problem hiding this comment.
Now you need to define what a constant is, because the aggregate here clearly isn't. Can we not go down this rabbit hole, please.
There was a problem hiding this comment.
I don't see the problem, but ok.
No description provided.