summaryrefslogtreecommitdiff
path: root/test/SemaCXX/warn-exit-time-destructors.cpp
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2011-03-24 01:01:41 +0000
committerAnders Carlsson <andersca@mac.com>2011-03-24 01:01:41 +0000
commit2b32dad701ef3e666e3b9cea02e1d094a1078c6f (patch)
treec9e7dc73e253f2bc5ede3663665807202bd0866c /test/SemaCXX/warn-exit-time-destructors.cpp
parent5188507b9a1b09ec95c14ffadf0e832f2b47aa8a (diff)
downloadclang-2b32dad701ef3e666e3b9cea02e1d094a1078c6f.tar.gz
Add a new warning for exit-time destructors.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128188 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaCXX/warn-exit-time-destructors.cpp')
-rw-r--r--test/SemaCXX/warn-exit-time-destructors.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/test/SemaCXX/warn-exit-time-destructors.cpp b/test/SemaCXX/warn-exit-time-destructors.cpp
new file mode 100644
index 0000000000..f49134b71c
--- /dev/null
+++ b/test/SemaCXX/warn-exit-time-destructors.cpp
@@ -0,0 +1,27 @@
+// RUN: %clang_cc1 -fsyntax-only -Wexit-time-destructors %s -verify
+
+namespace test1 {
+ struct A { ~A(); };
+ A a; // expected-warning {{declaration requires an exit-time destructor}}
+ A b[10]; // expected-warning {{declaration requires an exit-time destructor}}
+ A c[10][10]; // expected-warning {{declaration requires an exit-time destructor}}
+
+ A &d = a;
+ A &e = b[5];
+ A &f = c[5][7];
+}
+
+namespace test2 {
+void f() {
+ struct A { ~A() { } };
+
+ static A a; // expected-warning {{declaration requires an exit-time destructor}}
+ static A b[10]; // expected-warning {{declaration requires an exit-time destructor}}
+ static A c[10][10]; // expected-warning {{declaration requires an exit-time destructor}}
+
+ static A &d = a;
+ static A &e = b[5];
+ static A &f = c[5][7];
+}
+
+}