]> granicus.if.org Git - clang/commit
Sema: Disallow derived classes with virtual bases from having flexible array members
authorDavid Majnemer <david.majnemer@gmail.com>
Sat, 2 Nov 2013 11:19:13 +0000 (11:19 +0000)
committerDavid Majnemer <david.majnemer@gmail.com>
Sat, 2 Nov 2013 11:19:13 +0000 (11:19 +0000)
commit3a665576c16c353d8f524189d695e3c9140eefb8
treeb53bb8e9e8baeb9994234a53537751a2cd1feddc
parent633c0c2fbc1d9272b3f25220ffb8fe4b04ece3db
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@193920 91177308-0d34-0410-b5e6-96231b3b80d8
include/clang/Basic/DiagnosticSemaKinds.td
lib/Sema/SemaDecl.cpp
test/SemaCXX/flexible-array-test.cpp