gcc/testsuite/g++.dg/warn/Wunused-var-15.C
raw| 1 | // PR c++/45588 |
| 2 | // { dg-do compile } |
| 3 | // { dg-options "-Wunused" } |
| 4 | |
| 5 | void bar (unsigned char *); |
| 6 | |
| 7 | template <int N> |
| 8 | struct S |
| 9 | { |
| 10 | static const int k = 6; |
| 11 | }; |
| 12 | |
| 13 | template <int N> |
| 14 | const int S<N>::k; |
| 15 | |
| 16 | template <int N> |
| 17 | void |
| 18 | foo () |
| 19 | { |
| 20 | const int i = S<N>::k; |
| 21 | unsigned char a[i]; |
| 22 | bar (a); |
| 23 | } |
| 24 | |
| 25 | void |
| 26 | baz () |
| 27 | { |
| 28 | foo<0> (); |
| 29 | } |