blob: 3324215621bf8b8db9c58a90e87b7792d6ef8f66 [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}}
Ted Kremenek53b24eb2011-03-17 05:34:58 +000019 if (bar() || baz() || Foo() || init(&x))
20 return 1.0;
21
Chandler Carruth584b9d62011-04-08 06:47:15 +000022 return x; // expected-warning {{variable 'x' may be uninitialized when used here}}
Ted Kremenekc5e43c12011-03-17 05:29:57 +000023}