summaryrefslogtreecommitdiffstats
path: root/clang/test/Analysis/diagnostics/no-store-func-path-notes.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test/Analysis/diagnostics/no-store-func-path-notes.cpp')
-rw-r--r--clang/test/Analysis/diagnostics/no-store-func-path-notes.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/clang/test/Analysis/diagnostics/no-store-func-path-notes.cpp b/clang/test/Analysis/diagnostics/no-store-func-path-notes.cpp
index b869f81b6dd..6e7aca05c88 100644
--- a/clang/test/Analysis/diagnostics/no-store-func-path-notes.cpp
+++ b/clang/test/Analysis/diagnostics/no-store-func-path-notes.cpp
@@ -357,3 +357,18 @@ int forceElementRegionApperence() {
return ((HasFieldB*)&a)->x; // expected-warning{{Undefined or garbage value returned to caller}}
// expected-note@-1{{Undefined or garbage value returned to caller}}
}
+
+////////
+
+struct HasForgottenField {
+ int x;
+ HasForgottenField() {} // expected-note{{Returning without writing to 'this->x'}}
+};
+
+// Test that tracking across exclamation mark works.
+bool tracksThroughExclamationMark() {
+ HasForgottenField a; // expected-note{{Calling default constructor for 'HasForgottenField'}}
+ // expected-note@-1{{Returning from default constructor for 'HasForgottenField'}}
+ return !a.x; // expected-warning{{Undefined or garbage value returned to caller}}
+ // expected-note@-1{{Undefined or garbage value returned to caller}}
+}
OpenPOWER on IntegriCloud