]> granicus.if.org Git - clang/commitdiff
Add missing test from r163874.
authorDouglas Gregor <dgregor@apple.com>
Fri, 14 Sep 2012 16:38:59 +0000 (16:38 +0000)
committerDouglas Gregor <dgregor@apple.com>
Fri, 14 Sep 2012 16:38:59 +0000 (16:38 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163910 91177308-0d34-0410-b5e6-96231b3b80d8

test/SemaCXX/attr-unused.cpp [new file with mode: 0644]

diff --git a/test/SemaCXX/attr-unused.cpp b/test/SemaCXX/attr-unused.cpp
new file mode 100644 (file)
index 0000000..b74bc91
--- /dev/null
@@ -0,0 +1,9 @@
+// RUN: %clang_cc1 -verify -Wunused -Wused-but-marked-unused -fsyntax-only %s
+
+namespace ns_unused { typedef int Int_unused __attribute__((unused)); }
+namespace ns_not_unused { typedef int Int_not_unused; }
+
+void f() {
+  ns_not_unused::Int_not_unused i1; // expected-warning {{unused variable}}
+  ns_unused::Int_unused i0; // expected-warning {{'Int_unused' was marked unused but was used}}
+}