1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -fsyntax-only -verify %s 2*f4a2713aSLionel Sambuc // pr7029 3*f4a2713aSLionel Sambuc 4*f4a2713aSLionel Sambuc template <class Key, class T> struct QMap 5*f4a2713aSLionel Sambuc { 6*f4a2713aSLionel Sambuc void insert(const Key &, const T &); 7*f4a2713aSLionel Sambuc T v; 8*f4a2713aSLionel Sambuc }; 9*f4a2713aSLionel Sambuc 10*f4a2713aSLionel Sambuc 11*f4a2713aSLionel Sambuc template <class Key, class T> 12*f4a2713aSLionel Sambuc void QMap<Key, T>::insert(const Key &, const T &avalue) 13*f4a2713aSLionel Sambuc { 14*f4a2713aSLionel Sambuc v = avalue; 15*f4a2713aSLionel Sambuc } 16*f4a2713aSLionel Sambuc 17*f4a2713aSLionel Sambuc 18*f4a2713aSLionel Sambuc struct inotify_event 19*f4a2713aSLionel Sambuc { 20*f4a2713aSLionel Sambuc int wd; 21*f4a2713aSLionel Sambuc 22*f4a2713aSLionel Sambuc // clang doesn't like '[]': 23*f4a2713aSLionel Sambuc // cannot initialize a parameter of type 'void *' with an rvalue of type 'char (*)[]' 24*f4a2713aSLionel Sambuc char name []; 25*f4a2713aSLionel Sambuc }; 26*f4a2713aSLionel Sambuc 27*f4a2713aSLionel Sambuc 28*f4a2713aSLionel Sambuc void foo() 29*f4a2713aSLionel Sambuc { 30*f4a2713aSLionel Sambuc inotify_event event; 31*f4a2713aSLionel Sambuc inotify_event* ptr = &event; 32*f4a2713aSLionel Sambuc inotify_event event1 = *ptr; 33*f4a2713aSLionel Sambuc *ptr = event; 34*f4a2713aSLionel Sambuc QMap<int, inotify_event> eventForId; 35*f4a2713aSLionel Sambuc eventForId.insert(ptr->wd, *ptr); 36*f4a2713aSLionel Sambuc } 37*f4a2713aSLionel Sambuc 38*f4a2713aSLionel Sambuc struct S { 39*f4a2713aSLionel Sambuc virtual void foo(); 40*f4a2713aSLionel Sambuc }; 41*f4a2713aSLionel Sambuc 42*f4a2713aSLionel Sambuc struct X { 43*f4a2713aSLionel Sambuc int blah; 44*f4a2713aSLionel Sambuc S strings[]; // expected-error {{flexible array member 'strings' of non-POD element type 'S []'}} 45*f4a2713aSLionel Sambuc }; 46*f4a2713aSLionel Sambuc 47*f4a2713aSLionel Sambuc class A { 48*f4a2713aSLionel Sambuc int s; 49*f4a2713aSLionel Sambuc char c[]; 50*f4a2713aSLionel Sambuc }; 51*f4a2713aSLionel Sambuc 52*f4a2713aSLionel Sambuc union B { 53*f4a2713aSLionel Sambuc int s; 54*f4a2713aSLionel Sambuc char c[]; 55*f4a2713aSLionel Sambuc }; 56*f4a2713aSLionel Sambuc 57*f4a2713aSLionel Sambuc namespace rdar9065507 { 58*f4a2713aSLionel Sambuc 59*f4a2713aSLionel Sambuc struct StorageBase { 60*f4a2713aSLionel Sambuc long ref_count; 61*f4a2713aSLionel Sambuc unsigned size; 62*f4a2713aSLionel Sambuc unsigned capacity; 63*f4a2713aSLionel Sambuc }; 64*f4a2713aSLionel Sambuc 65*f4a2713aSLionel Sambuc struct Storage : StorageBase { 66*f4a2713aSLionel Sambuc int data[]; 67*f4a2713aSLionel Sambuc }; 68*f4a2713aSLionel Sambuc 69*f4a2713aSLionel Sambuc struct VirtStorage : virtual StorageBase { 70*f4a2713aSLionel Sambuc int data[]; // expected-error {{flexible array member 'data' not allowed in struct which has a virtual base class}} 71*f4a2713aSLionel Sambuc }; 72*f4a2713aSLionel Sambuc 73*f4a2713aSLionel Sambuc } 74