1 // RUN: %clang_cc1 -fsyntax-only -verify %s
4 template <class Key
, class T
> struct QMap
6 void insert(const Key
&, const T
&);
11 template <class Key
, class T
>
12 void QMap
<Key
, T
>::insert(const Key
&, const T
&avalue
)
18 union { // expected-warning-re {{variable sized type '{{.*}}' not at the end of a struct or class is a GNU extension}}
28 // clang doesn't like '[]':
29 // cannot initialize a parameter of type 'void *' with an rvalue of type 'char (*)[]'
37 inotify_event
* ptr
= &event
;
38 inotify_event event1
= *ptr
;
40 QMap
<int, inotify_event
> eventForId
;
41 eventForId
.insert(ptr
->wd
, *ptr
);
70 char c
[]; // expected-error {{flexible array member 'c' with type 'char[]' is not at the end of class}}
71 int s
; // expected-note {{next field declaration is here}}
74 namespace rdar9065507
{
82 struct Storage
: StorageBase
{
86 struct VirtStorage
: virtual StorageBase
{
87 int data
[]; // expected-error {{flexible array member 'data' not allowed in struct which has a virtual base class}}
92 struct NonTrivDtor
{ ~NonTrivDtor(); };
93 // FIXME: It's not clear whether we should disallow examples like this. GCC accepts.
94 struct FlexNonTrivDtor
{
96 NonTrivDtor ntd
[]; // expected-error {{flexible array member 'ntd' of type 'NonTrivDtor[]' with non-trivial destruction}}
98 for (int i
= n
; i
!= 0; --i
)
99 ntd
[i
-1].~NonTrivDtor();