1 // RUN: %clang_cc1 -fsyntax-only -pedantic -verify %s
6 // Element type cannot be:
8 volatile void ar2
[10]; // expected-error {{incomplete element type 'volatile void'}}
10 int& ar3
[10]; // expected-error {{array of references}}
13 Fn ar4
[10]; // expected-error {{array of functions}}
14 // - an abstract class
15 struct Abstract
{ virtual void fn() = 0; }; // expected-note {{pure virtual}}
16 Abstract ar5
[10]; // expected-error {{abstract class}}
18 // If we have a size, it must be greater than zero.
19 int ar6
[-1]; // expected-error {{array with a negative size}}
20 int ar7
[0u]; // expected-warning {{zero size arrays are an extension}}
22 // An array with unknown bound is incomplete.
23 int ar8
[]; // expected-error {{needs an explicit size or an initializer}}
24 // So is an array with an incomplete element type.
25 struct Incomplete
; // expected-note {{forward declaration}}
26 Incomplete ar9
[10]; // expected-error {{incomplete type}}
27 // Neither of which should be a problem in situations where no complete type
28 // is required. (PR5048)
29 void fun(int p1
[], Incomplete p2
[10]);
31 extern Incomplete ear2
[10];
33 // cv migrates to element type
34 typedef const int cint
;
36 typedef int intar
[10];
37 // thus this is a valid redeclaration
38 extern const intar car1
;
40 // Check that instantiation works properly when the element type is a template.
41 template <typename T
> struct S
{
42 typename
T::type x
; // expected-error {{has no members}}
44 S
<int> ar10
[10]; // expected-note {{requested here}}
46 // Ensure that negative array size errors include the name of the declared
47 // array as this is often used to simulate static_assert with template
48 // instantiations, placing the 'error message' in the declarator name.
51 [-1]; // expected-error {{user_error_message}}
53 another_user_error_message
54 [-1]; // expected-error {{another_user_error_message}}