SequenceChecker is currently not visiting default arguments and default initializers.
It is therefore missing cases like:
int a;
int foo(int x = a++, int y = a);
void test() {
foo(); // should warn
foo(a++); // idem
}or
int a;
struct X { int b = ++a; }; // aggregate in C++14
void test() {
int c = X{}.b + a; // should warn in C++14
}This patch modify SequenceChecker to visit default arguments and default initializers.
We additionally maintain a chain of additional source location information about where
default arguments and/or default initializers were used. Most of the time only one element
will be present in the chain but in general we might have to show a path through default
arguments and/or default initializers.
I think it's important that we handle this in the near future (though I don't mind if you'd like to submit this patch as-is and deal with this as a follow-on). For a case like:
... a warning that only gives the location of the default argument is not useful. We need to show both locations (and potentially a path through multiple default arguments, I suppose; yuck).