For array pointee type, get its cvr qualifier from

its element type. Fixes pr5432.

llvm-svn: 86587
This commit is contained in:
Fariborz Jahanian 2009-11-09 21:02:05 +00:00
parent b2eae89108
commit facfdd4d93
2 changed files with 12 additions and 0 deletions

View File

@ -2982,6 +2982,8 @@ BuiltinCandidateTypeSet::AddPointerWithMoreQualifiedTypeVariants(QualType Ty,
QualType PointeeTy = PointerTy->getPointeeType();
unsigned BaseCVR = PointeeTy.getCVRQualifiers();
if (const ConstantArrayType *Array = PointeeTy->getAs<ConstantArrayType>())
BaseCVR = Array->getElementType().getCVRQualifiers();
bool hasVolatile = VisibleQuals.hasVolatile();
bool hasRestrict = VisibleQuals.hasRestrict();

View File

@ -175,3 +175,13 @@ void test_dr425(A a) {
(void)(1.0f * a); // expected-error{{ambiguous}} \
// expected-note 81{{candidate}}
}
// pr5432
enum e {X};
const int a[][2] = {{1}};
int test_pr5432() {
return a[X][X];
}