blob: 3c44c7249d51ba3f301a13976ba0cf28a43f294f [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() {
David Blaikie4f4f3492011-09-10 05:35:08 +000018 double x; // expected-note{{initialize the variable 'x' 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}