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