When collecting types for built-in candidates, make arrays decay to pointers. Otherwise, subscripting an array leads to no candidates at all. Fixes PR5360.

llvm-svn: 86140
This commit is contained in:
Sebastian Redl 2009-11-05 16:36:20 +00:00
parent d3f630f4d5
commit 65ae200a13
2 changed files with 15 additions and 0 deletions

View File

@ -3052,6 +3052,10 @@ BuiltinCandidateTypeSet::AddTypesConvertedFrom(QualType Ty,
// We don't care about qualifiers on the type.
Ty = Ty.getUnqualifiedType();
// If we're dealing with an array type, decay to the pointer.
if (Ty->isArrayType())
Ty = SemaRef.Context.getArrayDecayedType(Ty);
if (const PointerType *PointerTy = Ty->getAs<PointerType>()) {
QualType PointeeTy = PointerTy->getPointeeType();

View File

@ -268,3 +268,14 @@ void circ() {
CircA a;
a->val = 0; // expected-error {{circular pointer delegation detected}}
}
// PR5360: Arrays should lead to built-in candidates for subscript.
typedef enum {
LastReg = 23,
} Register;
class RegAlloc {
int getPriority(Register r) {
return usepri[r];
}
int usepri[LastReg + 1];
};