}
void ClassifyRefs::classify(const Expr *E, Class C) {
+ // The result of a ?: could also be an lvalue.
+ E = E->IgnoreParens();
+ if (const ConditionalOperator *CO = dyn_cast<ConditionalOperator>(E)) {
+ const Expr *TrueExpr = CO->getTrueExpr();
+ if (!isa<OpaqueValueExpr>(TrueExpr))
+ classify(TrueExpr, C);
+ classify(CO->getFalseExpr(), C);
+ return;
+ }
+
FindVarResult Var = findVar(E, DC);
if (const DeclRefExpr *DRE = Var.getDeclRefExpr())
Classification[DRE] = std::max(Classification[DRE], C);
int j = far(j);
int k = __alignof__(k);
- int l = k ? l : l; // FIXME: warn here
- int m = 1 + (k ? m : m); // FIXME: warn here
+ int l = k ? l : l; // expected-warning {{variable 'l' is uninitialized when used within its own initialization}}
+ int m = 1 + (k ? m : m); // expected-warning {{'m' is uninitialized when used within its own initialization}}
int n = -n; // expected-warning {{variable 'n' is uninitialized when used within its own initialization}}
for (;;) {
int j = far(j);
int k = __alignof__(k);
- int l = k ? l : l; // FIXME: warn here
- int m = 1 + (k ? m : m); // FIXME: warn here
+ int l = k ? l : l; // expected-warning {{variable 'l' is uninitialized when used within its own initialization}}
+ int m = 1 + (k ? m : m); // expected-warning {{'m' is uninitialized when used within its own initialization}}
int n = -n; // expected-warning {{variable 'n' is uninitialized when used within its own initialization}}
}
}