// RUN: %clang_cc1 -fsyntax-only -verify %s
// pr7029
template<class Key,class T>structQMap{voidinsert(const Key &,const T &);T v;};template<class Key,class T>voidQMap<Key, T>::insert(const Key &,const T &avalue){
v = avalue;}structRec{union{// expected-warning-re {{variable sized type '{{.*}}' not at the end of a struct or class is a GNU extension}}
int u0[];};int x;} rec;structinotify_event{int wd;// clang doesn't like '[]':
// cannot initialize a parameter of type 'void *' with an rvalue of type 'char (*)[]'
char name [];};voidfoo(){
inotify_event event;
inotify_event* ptr =&event;
inotify_event event1 =*ptr;*ptr = event;
QMap<int, inotify_event> eventForId;
eventForId.insert(ptr->wd,*ptr);}structS{virtualvoidfoo();};structX{int blah;S strings[];};
S a, b = a;
S f(X &x){
a = b;return x.strings[0];}classA{int s;char c[];};unionB{int s;char c[];};classC{char c[];// expected-error {{flexible array member 'c' with type 'char[]' is not at the end of class}}
int s;// expected-note {{next field declaration is here}}
};namespacerdar9065507{structStorageBase{long ref_count;unsigned size;unsigned capacity;};structStorage:StorageBase{int data[];};structVirtStorage:virtualStorageBase{int data[];// expected-error {{flexible array member 'data' not allowed in struct which has a virtual base class}}
};}structNonTrivDtor{~NonTrivDtor();};// FIXME: It's not clear whether we should disallow examples like this. GCC accepts.
structFlexNonTrivDtor{int n;
NonTrivDtor ntd[];// expected-error {{flexible array member 'ntd' of type 'NonTrivDtor[]' with non-trivial destruction}}
~FlexNonTrivDtor(){for(int i = n; i !=0;--i)
ntd[i-1].~NonTrivDtor();}};