2011-03-17 13:29:57 +08:00
|
|
|
// RUN: %clang_cc1 -fsyntax-only -Wconditional-uninitialized -fsyntax-only %s -verify
|
|
|
|
|
|
|
|
class Foo {
|
|
|
|
public:
|
|
|
|
Foo();
|
|
|
|
~Foo();
|
|
|
|
operator bool();
|
|
|
|
};
|
|
|
|
|
|
|
|
int bar();
|
|
|
|
int baz();
|
|
|
|
int init(double *);
|
|
|
|
|
|
|
|
// This case flags a false positive under -Wconditional-uninitialized because
|
|
|
|
// the destructor in Foo fouls about the minor bit of path-sensitivity in
|
|
|
|
// -Wuninitialized.
|
|
|
|
double test() {
|
|
|
|
double x; // expected-note {{variable 'x' is declared here}} expected-note{{add initialization to silence this warning}}
|
2011-03-17 13:34:58 +08:00
|
|
|
if (bar() || baz() || Foo() || init(&x))
|
|
|
|
return 1.0;
|
|
|
|
|
2011-04-08 14:47:15 +08:00
|
|
|
return x; // expected-warning {{variable 'x' may be uninitialized when used here}}
|
2011-03-17 13:29:57 +08:00
|
|
|
}
|