summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2012-07-07 23:00:31 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2012-07-07 23:00:31 +0000
commitcd3d5d95974b52076f28fdccb056bf12b917994c (patch)
tree3d83c634af7287371f78a43db5e11e641420bd1b /clang/lib
parent1b9f2eb76b5d40949ba579decb04790bb6983735 (diff)
downloadbcm5719-llvm-cd3d5d95974b52076f28fdccb056bf12b917994c.tar.gz
bcm5719-llvm-cd3d5d95974b52076f28fdccb056bf12b917994c.zip
Reject 'int a[1][];' in Sema rather than crashing in IR generation. Found by a
misreduction of PR13290. llvm-svn: 159905
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Sema/SemaType.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaType.cpp b/clang/lib/Sema/SemaType.cpp
index 694a94d5566..84e8a7944d9 100644
--- a/clang/lib/Sema/SemaType.cpp
+++ b/clang/lib/Sema/SemaType.cpp
@@ -1249,6 +1249,11 @@ QualType Sema::BuildArrayType(QualType T, ArrayType::ArraySizeModifier ASM,
// type, the (possibly cv-qualified) type void, a function type or an
// abstract class type.
//
+ // C++ [dcl.array]p3:
+ // When several "array of" specifications are adjacent, [...] only the
+ // first of the constant expressions that specify the bounds of the arrays
+ // may be omitted.
+ //
// Note: function types are handled in the common path with C.
if (T->isReferenceType()) {
Diag(Loc, diag::err_illegal_decl_array_of_references)
@@ -1256,7 +1261,7 @@ QualType Sema::BuildArrayType(QualType T, ArrayType::ArraySizeModifier ASM,
return QualType();
}
- if (T->isVoidType()) {
+ if (T->isVoidType() || T->isIncompleteArrayType()) {
Diag(Loc, diag::err_illegal_decl_array_incomplete_type) << T;
return QualType();
}
OpenPOWER on IntegriCloud