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