| 1 |
// RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 -pedantic -Werror %s |
| 2 |
int a1[] = { 1, 3, 5 }; |
| 3 |
void f() { |
| 4 |
int a2[] = { 1, 3, 5 }; |
| 5 |
} |
| 6 |
template <typename T> |
| 7 |
void tf() { |
| 8 |
T t; |
| 9 |
// Element type may be dependent |
| 10 |
T a3[] = { 1, 3, 5 }; |
| 11 |
// As might be the initializer list, value |
| 12 |
int a5[] = { sizeof(T) }; |
| 13 |
// or even type. |
| 14 |
int a6[] = { t.get() }; |
| 15 |
} |
| 16 |
|
| 17 |
// Allowed by GNU extension |
| 18 |
int a4[] = {}; // expected-error {{zero size arrays}} |
| 19 |
|
| 20 |
struct Incomplete; // expected-note {{forward declaration of 'Incomplete'}} |
| 21 |
struct A { |
| 22 |
Incomplete i; // expected-error {{field has incomplete type 'Incomplete'}} |
| 23 |
}; |
| 24 |
A a[] = { 0 }; // PR13971: don't hang. |