xref: /minix3/external/bsd/llvm/dist/clang/test/SemaCXX/vla.cpp (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1f4a2713aSLionel Sambuc // RUN: %clang_cc1 -verify %s
2f4a2713aSLionel Sambuc 
3f4a2713aSLionel Sambuc // PR11925
4f4a2713aSLionel Sambuc int n;
5f4a2713aSLionel Sambuc int (&f())[n]; // expected-error {{function declaration cannot have variably modified type}}
6*0a6a1f1dSLionel Sambuc 
7*0a6a1f1dSLionel Sambuc namespace PR18581 {
8*0a6a1f1dSLionel Sambuc   template<typename T> struct pod {};
9*0a6a1f1dSLionel Sambuc   template<typename T> struct error {
10*0a6a1f1dSLionel Sambuc     typename T::error e; // expected-error {{cannot be used prior to '::'}}
11*0a6a1f1dSLionel Sambuc   };
12*0a6a1f1dSLionel Sambuc   struct incomplete; // expected-note {{forward declaration}}
13*0a6a1f1dSLionel Sambuc 
f(int n)14*0a6a1f1dSLionel Sambuc   void f(int n) {
15*0a6a1f1dSLionel Sambuc     pod<int> a[n];
16*0a6a1f1dSLionel Sambuc     error<int> b[n]; // expected-note {{instantiation}}
17*0a6a1f1dSLionel Sambuc     incomplete c[n]; // expected-error {{incomplete}}
18*0a6a1f1dSLionel Sambuc   }
19*0a6a1f1dSLionel Sambuc }
20