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:
parent
d3f630f4d5
commit
65ae200a13
|
@ -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();
|
||||
|
||||
|
|
|
@ -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];
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue