2009-12-16 04:14:24 +08:00
|
|
|
// RUN: %clang_cc1 -fsyntax-only -pedantic -verify %s
|
2009-11-20 02:03:26 +08:00
|
|
|
|
|
|
|
template<int N>
|
|
|
|
void f() {
|
|
|
|
int a[] = { 1, 2, 3, N };
|
|
|
|
unsigned numAs = sizeof(a) / sizeof(int);
|
|
|
|
}
|
|
|
|
|
|
|
|
template void f<17>();
|
|
|
|
|
2009-11-20 07:25:22 +08:00
|
|
|
|
|
|
|
template<int N>
|
|
|
|
void f1() {
|
|
|
|
int a0[] = {}; // expected-warning{{zero}}
|
|
|
|
int a1[] = { 1, 2, 3, N };
|
|
|
|
int a3[sizeof(a1)/sizeof(int) != 4? 1 : -1]; // expected-error{{negative}}
|
|
|
|
}
|
2012-11-10 07:03:14 +08:00
|
|
|
|
|
|
|
namespace PR13788 {
|
|
|
|
template <unsigned __N>
|
|
|
|
struct S {
|
|
|
|
int V;
|
|
|
|
};
|
|
|
|
template <int N>
|
|
|
|
void foo() {
|
|
|
|
S<0> arr[N] = {{ 4 }};
|
|
|
|
}
|
|
|
|
}
|