diff options
| author | Roman Divacky <rdivacky@FreeBSD.org> | 2010-05-27 15:17:06 +0000 |
|---|---|---|
| committer | Roman Divacky <rdivacky@FreeBSD.org> | 2010-05-27 15:17:06 +0000 |
| commit | d7279c4c177bca357ef96ff1379fd9bc420bfe83 (patch) | |
| tree | 3558f327a6f9ab59c5d7a06528d84e1560445247 /test/SemaCXX/flexible-array-test.cpp | |
| parent | be17651f5cd2e94922c1b732bc8589e180698193 (diff) | |
Notes
Diffstat (limited to 'test/SemaCXX/flexible-array-test.cpp')
| -rw-r--r-- | test/SemaCXX/flexible-array-test.cpp | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/test/SemaCXX/flexible-array-test.cpp b/test/SemaCXX/flexible-array-test.cpp new file mode 100644 index 000000000000..02e3f83974e2 --- /dev/null +++ b/test/SemaCXX/flexible-array-test.cpp @@ -0,0 +1,45 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s +// pr7029 + +template <class Key, class T> struct QMap +{ + void insert(const Key &, const T &); + T v; +}; + + +template <class Key, class T> +void QMap<Key, T>::insert(const Key &, const T &avalue) +{ + v = avalue; +} + + +struct inotify_event +{ + int wd; + + // clang doesn't like '[]': + // cannot initialize a parameter of type 'void *' with an rvalue of type 'char (*)[]' + char name []; +}; + + +void foo() +{ + inotify_event event; + inotify_event* ptr = &event; + inotify_event event1 = *ptr; + *ptr = event; + QMap<int, inotify_event> eventForId; + eventForId.insert(ptr->wd, *ptr); +} + +struct S { + virtual void foo(); +}; + +struct X { + int blah; + S strings[]; // expected-error {{flexible array member 'strings' of non-POD element type 'S []'}} +}; |
