Improve printing of const variable sized arrays
Follow-on from 40acc0adad
with help from
Richard Smith on how to provoke this particular case.
This commit is contained in:
parent
c0a6381e49
commit
39093279f2
|
@ -242,6 +242,7 @@ bool TypePrinter::canPrefixQualifiers(const Type *T,
|
|||
T->isObjCQualifiedIdType() || T->isObjCQualifiedClassType();
|
||||
break;
|
||||
|
||||
case Type::VariableArray:
|
||||
case Type::DependentSizedArray:
|
||||
NeedARCStrongQualifier = true;
|
||||
LLVM_FALLTHROUGH;
|
||||
|
@ -251,9 +252,6 @@ bool TypePrinter::canPrefixQualifiers(const Type *T,
|
|||
return canPrefixQualifiers(
|
||||
cast<ArrayType>(UnderlyingType)->getElementType().getTypePtr(),
|
||||
NeedARCStrongQualifier);
|
||||
case Type::VariableArray:
|
||||
NeedARCStrongQualifier = true;
|
||||
LLVM_FALLTHROUGH;
|
||||
|
||||
case Type::Adjusted:
|
||||
case Type::Decayed:
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
// RUN: %clang_cc1 %s -verify -fsyntax-only
|
||||
|
||||
void f1(int n) {
|
||||
typedef int x[n];
|
||||
const x y; // expected-error {{default initialization of an object of const type 'const x' (aka 'const int [n]')}}
|
||||
}
|
Loading…
Reference in New Issue