summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/warn/Wunused-var-15.C
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/g++.dg/warn/Wunused-var-15.C')
-rw-r--r--gcc/testsuite/g++.dg/warn/Wunused-var-15.C29
1 files changed, 29 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/warn/Wunused-var-15.C b/gcc/testsuite/g++.dg/warn/Wunused-var-15.C
new file mode 100644
index 000000000..9782ccbd9
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Wunused-var-15.C
@@ -0,0 +1,29 @@
+// PR c++/45588
+// { dg-do compile }
+// { dg-options "-Wunused" }
+
+void bar (unsigned char *);
+
+template <int N>
+struct S
+{
+ static const int k = 6;
+};
+
+template <int N>
+const int S<N>::k;
+
+template <int N>
+void
+foo ()
+{
+ const int i = S<N>::k;
+ unsigned char a[i];
+ bar (a);
+}
+
+void
+baz ()
+{
+ foo<0> ();
+}