aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaType.cpp
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
commitbb35151a166db2b4fee043bc90e60858ac2b7a89 (patch)
tree3ac237e0ff9565c945a61bbd8e76bf4ceb901118 /lib/Sema/SemaType.cpp
parentde31aa7f0ef71f5c162372e319cbc03c0924f074 (diff)
Reject 'int a[1][];' in Sema rather than crashing in IR generation. Found by a
misreduction of PR13290. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159905 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaType.cpp')
-rw-r--r--lib/Sema/SemaType.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/Sema/SemaType.cpp b/lib/Sema/SemaType.cpp
index 694a94d556..84e8a7944d 100644
--- a/lib/Sema/SemaType.cpp
+++ b/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();
}