summaryrefslogtreecommitdiffstats
path: root/test/Analysis/unions.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/Analysis/unions.cpp')
-rw-r--r--test/Analysis/unions.cpp22
1 files changed, 21 insertions, 1 deletions
diff --git a/test/Analysis/unions.cpp b/test/Analysis/unions.cpp
index 618d4c314a..6fd35d1a43 100644
--- a/test/Analysis/unions.cpp
+++ b/test/Analysis/unions.cpp
@@ -1,6 +1,7 @@
// RUN: %clang_analyze_cc1 -analyzer-checker=core,unix.Malloc,debug.ExprInspection %s -analyzer-config eagerly-assume=false -verify
extern void clang_analyzer_eval(bool);
+extern void clang_analyzer_warnIfReached();
extern "C" char *strdup(const char *s);
namespace PR14054_reduced {
@@ -35,7 +36,7 @@ namespace PR14054_original {
struct ParseNode {
union {
struct {
- union {};
+ union {}; // expected-warning {{does not declare anything}}
Definition *lexdef;
} name;
class {
@@ -121,3 +122,22 @@ void test() {
y = 1 / y; // no-warning
}
} // end namespace assume_union_contents
+
+namespace pr37688_deleted_union_destructor {
+struct S { ~S(); };
+struct A {
+ ~A() noexcept {}
+ union {
+ struct {
+ S s;
+ } ss;
+ };
+};
+void foo() {
+ A a;
+} // no-crash
+void bar() {
+ foo();
+ clang_analyzer_warnIfReached(); // expected-warning{{REACHABLE}}
+}
+} // end namespace pr37688_deleted_union_destructor