Daniel Dunbar | 8fbe78f | 2009-12-15 20:14:24 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -fsyntax-only -pedantic -verify %s |
Douglas Gregor | ad2956c | 2009-11-19 18:03:26 +0000 | [diff] [blame] | 2 | |
| 3 | template<int N> |
| 4 | void f() { |
| 5 | int a[] = { 1, 2, 3, N }; |
| 6 | unsigned numAs = sizeof(a) / sizeof(int); |
| 7 | } |
| 8 | |
| 9 | template void f<17>(); |
| 10 | |
Douglas Gregor | deebf6e | 2009-11-19 23:25:22 +0000 | [diff] [blame] | 11 | |
| 12 | template<int N> |
| 13 | void f1() { |
| 14 | int a0[] = {}; // expected-warning{{zero}} |
| 15 | int a1[] = { 1, 2, 3, N }; |
| 16 | int a3[sizeof(a1)/sizeof(int) != 4? 1 : -1]; // expected-error{{negative}} |
| 17 | } |
Richard Smith | de63d36 | 2012-11-09 23:03:14 +0000 | [diff] [blame] | 18 | |
| 19 | namespace PR13788 { |
| 20 | template <unsigned __N> |
| 21 | struct S { |
| 22 | int V; |
| 23 | }; |
| 24 | template <int N> |
| 25 | void foo() { |
| 26 | S<0> arr[N] = {{ 4 }}; |
| 27 | } |
| 28 | } |