summaryrefslogtreecommitdiffstats
path: root/test/SemaCXX/warn-unused-attribute.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/SemaCXX/warn-unused-attribute.cpp')
-rw-r--r--test/SemaCXX/warn-unused-attribute.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/SemaCXX/warn-unused-attribute.cpp b/test/SemaCXX/warn-unused-attribute.cpp
new file mode 100644
index 0000000..72f96ee
--- /dev/null
+++ b/test/SemaCXX/warn-unused-attribute.cpp
@@ -0,0 +1,20 @@
+// RUN: %clang_cc1 -fsyntax-only -Wunused-variable -verify %s
+struct __attribute__((warn_unused)) Test
+{
+ Test();
+ ~Test();
+ void use();
+};
+
+struct TestNormal
+{
+ TestNormal();
+};
+
+int main()
+{
+ Test unused; // expected-warning {{unused variable 'unused'}}
+ Test used;
+ TestNormal normal;
+ used.use();
+}
OpenPOWER on IntegriCloud