summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/template/static21.C
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/g++.dg/template/static21.C')
-rw-r--r--gcc/testsuite/g++.dg/template/static21.C20
1 files changed, 20 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/template/static21.C b/gcc/testsuite/g++.dg/template/static21.C
new file mode 100644
index 000000000..66b045087
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/static21.C
@@ -0,0 +1,20 @@
+// PR c++/24389
+// { dg-additional-sources "static21-a.cc" }
+// { dg-do link }
+
+template<int dummy>
+struct X
+{
+ static const int n_primes = 256;
+ static const unsigned long primes[n_primes + 1];
+};
+
+template<int dummy>
+const int X<dummy>::n_primes;
+
+template<int dummy>
+const unsigned long X<dummy>::primes[n_primes + 1] =
+ { 0 };
+
+const unsigned long *f(void){return &X<0>::primes[0];}
+