diff --git a/clang/test/Analysis/a_flaky_crash.cpp b/clang/test/Analysis/a_flaky_crash.cpp new file mode 100644 --- /dev/null +++ b/clang/test/Analysis/a_flaky_crash.cpp @@ -0,0 +1,15 @@ +// RUN: %clang_analyze_cc1 -analyzer-checker=core -verify %s + +struct S { + S(); + ~S(); +}; + +bool bar(S); + +// no-crash during diagnostic construction. +void foo() { + int x; + if (true && bar(S())) + ++x; // expected-warning{{The expression is an uninitialized value. The computed value will also be garbage}} +}