summaryrefslogtreecommitdiff
path: root/test/Analysis/unions.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/Analysis/unions.cpp')
-rw-r--r--test/Analysis/unions.cpp20
1 files changed, 18 insertions, 2 deletions
diff --git a/test/Analysis/unions.cpp b/test/Analysis/unions.cpp
index 2758cdaa26b3a..2d6d0ae4a0db3 100644
--- a/test/Analysis/unions.cpp
+++ b/test/Analysis/unions.cpp
@@ -79,8 +79,7 @@ namespace PR17596 {
IntOrString vv;
vv.i = 5;
uu = vv;
- // FIXME: Should be true.
- clang_analyzer_eval(uu.i == 5); // expected-warning{{UNKNOWN}}
+ clang_analyzer_eval(uu.i == 5); // expected-warning{{TRUE}}
}
void testInvalidation() {
@@ -106,3 +105,20 @@ namespace PR17596 {
clang_analyzer_eval(uu.s[0] == 'a'); // expected-warning{{UNKNOWN}}
}
}
+
+namespace assume_union_contents {
+union U {
+ int x;
+};
+
+U get();
+
+void test() {
+ U u = get();
+ int y = 0;
+ if (u.x)
+ y = 1;
+ if (u.x)
+ y = 1 / y; // no-warning
+}
+} // end namespace assume_union_contents