The constructor that comes right before a variable declaration in the CFG might
not be the initialization of that variable. Previously, we just checked that
the variable's initializer expression was different from the construction
expression, but forgot to see whether the variable had an initializer expression
at all.
Thanks for the prompting, David.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207562
91177308-0d34-0410-b5e6-
96231b3b80d8
namespace PR19579 {
class C {};
- struct S {
- C c;
- int i;
- };
-
void f() {
C();
int a;
+
+ extern void use(int);
+ use(a); // expected-warning{{uninitialized}}
}
void g() {
+ struct S {
+ C c;
+ int i;
+ };
+
// This order triggers the initialization of the inner "a" after the
// constructor for "C" is run, which used to confuse the analyzer
// (is "C()" the initialization of "a"?).