xref: /minix3/external/bsd/llvm/dist/clang/test/SemaCXX/warn-vla.cpp (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -fsyntax-only -verify -Wvla %s
2*f4a2713aSLionel Sambuc 
test1(int n)3*f4a2713aSLionel Sambuc void test1(int n) {
4*f4a2713aSLionel Sambuc   int v[n]; // expected-warning {{variable length array used}}
5*f4a2713aSLionel Sambuc }
6*f4a2713aSLionel Sambuc 
test2(int n,int v[n])7*f4a2713aSLionel Sambuc void test2(int n, int v[n]) { // expected-warning {{variable length array used}}
8*f4a2713aSLionel Sambuc }
9*f4a2713aSLionel Sambuc 
10*f4a2713aSLionel Sambuc void test3(int n, int v[n]); // expected-warning {{variable length array used}}
11*f4a2713aSLionel Sambuc 
12*f4a2713aSLionel Sambuc template<typename T>
test4(int n)13*f4a2713aSLionel Sambuc void test4(int n) {
14*f4a2713aSLionel Sambuc   int v[n]; // expected-warning {{variable length array used}}
15*f4a2713aSLionel Sambuc }
16*f4a2713aSLionel Sambuc 
17*f4a2713aSLionel Sambuc template<typename T>
test5(int n,int v[n])18*f4a2713aSLionel Sambuc void test5(int n, int v[n]) { // expected-warning {{variable length array used}}
19*f4a2713aSLionel Sambuc }
20*f4a2713aSLionel Sambuc 
21*f4a2713aSLionel Sambuc template<typename T>
22*f4a2713aSLionel Sambuc void test6(int n, int v[n]); // expected-warning {{variable length array used}}
23*f4a2713aSLionel Sambuc 
24*f4a2713aSLionel Sambuc template<typename T>
test7(int n,T v[n])25*f4a2713aSLionel Sambuc void test7(int n, T v[n]) { // expected-warning {{variable length array used}}
26*f4a2713aSLionel Sambuc }
27*f4a2713aSLionel Sambuc 
28