blob: 1a822853d9488567716aef6a154b264e79322e41 [file] [log] [blame]
Ted Kremenekc5e43c12011-03-17 05:29:57 +00001// RUN: %clang_cc1 -fsyntax-only -Wconditional-uninitialized -fsyntax-only %s -verify
2
3class Foo {
4public:
5 Foo();
6 ~Foo();
7 operator bool();
8};
9
10int bar();
11int baz();
12int init(double *);
13
14// This case flags a false positive under -Wconditional-uninitialized because
15// the destructor in Foo fouls about the minor bit of path-sensitivity in
16// -Wuninitialized.
17double test() {
18 double x; // expected-note {{variable 'x' is declared here}} expected-note{{add initialization to silence this warning}}
19 if (bar() || baz() || Foo() || init(&x)) {
20 return x; // expected-warning {{variable 'x' is possibly uninitialized when used here}}
21 }
22 return 1.0;
23}