diff options
author | John McCall <rjmccall@apple.com> | 2010-12-15 04:42:30 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2010-12-15 04:42:30 +0000 |
commit | 5e3c67b4bd894a926282d24b4d0cbc0e123c9f4a (patch) | |
tree | b1bfcfbc4d91153c5f4d76ee4af95dde3b8b258d /lib/Sema/SemaType.cpp | |
parent | bfdcdc8e26097c9dbb4c40d78296f6ccc3e6684c (diff) |
Sundry missing lvalue-to-rvalue conversions. Also leave a TODO for the vital
future task of performing contextual conversion to size_t in a VLA size
expression. :)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121836 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaType.cpp')
-rw-r--r-- | lib/Sema/SemaType.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/Sema/SemaType.cpp b/lib/Sema/SemaType.cpp index 04440ef9a5..2eb2c0b7cf 100644 --- a/lib/Sema/SemaType.cpp +++ b/lib/Sema/SemaType.cpp @@ -680,7 +680,13 @@ QualType Sema::BuildArrayType(QualType T, ArrayType::ArraySizeModifier ASM, return QualType(); } + // Do lvalue-to-rvalue conversions on the array size expression. + if (ArraySize && !ArraySize->isRValue()) + DefaultLvalueConversion(ArraySize); + // C99 6.7.5.2p1: The size expression shall have integer type. + // TODO: in theory, if we were insane, we could allow contextual + // conversions to integer type here. if (ArraySize && !ArraySize->isTypeDependent() && !ArraySize->getType()->isIntegralOrUnscopedEnumerationType()) { Diag(ArraySize->getLocStart(), diag::err_array_size_non_int) |