summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX/flexible-array-test.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [Sema] Add support for flexible array members in Obj-C.Volodymyr Sapsai2017-10-231-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Allow Obj-C ivars with incomplete array type but only as the last ivar. Also add a requirement for ivars that contain a flexible array member to be at the end of class too. It is possible to add in a subclass another ivar at the end but we'll emit a warning in this case. Also we'll emit a warning if a variable sized ivar is declared in class extension or in implementation because subclasses won't know they should avoid adding new ivars. In ARC incomplete array objects are treated as __unsafe_unretained so require them to be marked as such. Prohibit synthesizing ivars with flexible array members because order of synthesized ivars is not obvious and tricky to control. Spelling out ivar explicitly gives control to developers and helps to avoid surprises with unexpected ivar ordering. For C and C++ changed diagnostic to tell explicitly a field is not the last one and point to the next field. It is not as useful as in Obj-C but it is an improvement and it is consistent with Obj-C. For C for unions emit more specific err_flexible_array_union instead of generic err_field_incomplete. rdar://problem/21054495 Reviewers: rjmccall, theraven Reviewed By: rjmccall Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D38773 llvm-svn: 316381
* Sema: Inherit the flexible array property from struct fieldsDavid Majnemer2014-09-241-0/+6
| | | | | | | | A record which contains a flexible array member is itself a flexible array member. A struct which contains such a record should also consider itself to be a flexible array member. llvm-svn: 218378
* Fix "regression" caused by updating our notion of POD to better match the C++11Richard Smith2014-01-111-2/+19
| | | | | | | | rules: instead of requiring flexible array members to be POD, require them to be trivially-destructible. This seems to be the only constraint that actually matters here (and even then, it's questionable whether this matters). llvm-svn: 198983
* Sema: Disallow derived classes with virtual bases from having flexible array ↵David Majnemer2013-11-021-0/+4
| | | | | | | | | | | | | | | members Flexible array members only work out if they are the last field of a record, however virtual bases would give us many situations where the flexible array member would overlap with the virtual base fields. It is unlikely in the extreme that this behavior was intended by the user so raise a diagnostic instead of accepting. This is will not reject conforming code because flexible array members are an extension in C++ mode. llvm-svn: 193920
* g++ is more permissive regarding flexible arrays.Argyrios Kyrtzidis2011-03-071-1/+15
| | | | | | | | It will accept flexible array in union and also as the sole element of a struct/class. Fixes rdar://9065507. llvm-svn: 127171
* It's OK for classes to have flexible array elements (but not unions).Anders Carlsson2010-09-031-0/+10
| | | | llvm-svn: 113018
* Improve on flexible array diagnostics (PR7029).Fariborz Jahanian2010-05-261-1/+1
| | | | llvm-svn: 104739
* Fixes misc. flexible array bugs in c++ (PR7029).Fariborz Jahanian2010-05-261-0/+45
llvm-svn: 104733
OpenPOWER on IntegriCloud