Open
Description
I recently found an -Wreorder
adjacent issue that does not get diagnosed. In the test_t
struct below, we initialize bar
using foo
member variable, but because foo
is declared after bar
, we are reading it before initialization. (this can happen e.g. by reordering the member without noticing the dependency).
struct test_t {
int bar{ foo + 1 };
int foo{ 3 };
};
int main() {
test_t t{};
}
Ideally this would also be caught under -Wreorder
or by -Wuninitialized
.