diff options
author | David Majnemer <david.majnemer@gmail.com> | 2013-11-02 11:19:13 +0000 |
---|---|---|
committer | David Majnemer <david.majnemer@gmail.com> | 2013-11-02 11:19:13 +0000 |
commit | 08cd76006fda60d8f006071ade1e16025f349287 (patch) | |
tree | 44036a07473f1033ec02166826776fd0e6f58698 /clang/test/SemaCXX | |
parent | 4101621dd7463226941602e007c3da1d4012f8ed (diff) | |
download | bcm5719-llvm-08cd76006fda60d8f006071ade1e16025f349287.tar.gz bcm5719-llvm-08cd76006fda60d8f006071ade1e16025f349287.zip |
Sema: Disallow derived classes with virtual bases from having flexible array 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
Diffstat (limited to 'clang/test/SemaCXX')
-rw-r--r-- | clang/test/SemaCXX/flexible-array-test.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/flexible-array-test.cpp b/clang/test/SemaCXX/flexible-array-test.cpp index e6c3132801f..f287711eeb6 100644 --- a/clang/test/SemaCXX/flexible-array-test.cpp +++ b/clang/test/SemaCXX/flexible-array-test.cpp @@ -66,4 +66,8 @@ struct Storage : StorageBase { int data[]; }; +struct VirtStorage : virtual StorageBase { + int data[]; // expected-error {{flexible array member 'data' not allowed in struct which has a virtual base class}} +}; + } |