diff options
author | Douglas Gregor <dgregor@apple.com> | 2009-02-10 21:49:46 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2009-02-10 21:49:46 +0000 |
commit | 0bfe54fdc83b7b4e37c40e652d86d15aa89885b2 (patch) | |
tree | 11a7e3a0d742ebdf07a48547b142d277b176ef65 /lib/Sema/SemaType.cpp | |
parent | b53e3e71383233ebb68a6a736cbe8af6d8065700 (diff) |
GNU allows structs with flexible array members to be placed inside
arrays and other structs/unions as an extension. Downgrade our error
to a warning. Fixes PR3540.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64239 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaType.cpp')
-rw-r--r-- | lib/Sema/SemaType.cpp | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/lib/Sema/SemaType.cpp b/lib/Sema/SemaType.cpp index 25fd5c39fe..e898782f31 100644 --- a/lib/Sema/SemaType.cpp +++ b/lib/Sema/SemaType.cpp @@ -399,12 +399,9 @@ QualType Sema::GetTypeForDeclarator(Declarator &D, Scope *S, unsigned Skip) { D.setInvalidType(true); } else if (const RecordType *EltTy = T->getAsRecordType()) { // If the element type is a struct or union that contains a variadic - // array, reject it: C99 6.7.2.1p2. - if (EltTy->getDecl()->hasFlexibleArrayMember()) { - Diag(DeclType.Loc, diag::err_flexible_array_in_array) << T; - T = Context.IntTy; - D.setInvalidType(true); - } + // array, accept it as a GNU extension: C99 6.7.2.1p2. + if (EltTy->getDecl()->hasFlexibleArrayMember()) + Diag(DeclType.Loc, diag::ext_flexible_array_in_array) << T; } else if (T->isObjCInterfaceType()) { Diag(DeclType.Loc, diag::warn_objc_array_of_interfaces) << T; } |