diff options
author | Sebastian Redl <sebastian.redl@getdesigned.at> | 2009-11-18 20:39:26 +0000 |
---|---|---|
committer | Sebastian Redl <sebastian.redl@getdesigned.at> | 2009-11-18 20:39:26 +0000 |
commit | 4990a6347a3a8935714f627746b713bafa5add86 (patch) | |
tree | ffaa027aed9763c5df28ea0987455ef51fb15bdd /clang/lib/Sema/SemaOverload.cpp | |
parent | 9cbffd2155d11d734a47e5baedac16f6f98c2c8a (diff) | |
download | bcm5719-llvm-4990a6347a3a8935714f627746b713bafa5add86.tar.gz bcm5719-llvm-4990a6347a3a8935714f627746b713bafa5add86.zip |
Don't generate superfluous and ambiguous built-in candidates for multi-level array subscript and arithmetic. Fixes PR5546.
llvm-svn: 89242
Diffstat (limited to 'clang/lib/Sema/SemaOverload.cpp')
-rw-r--r-- | clang/lib/Sema/SemaOverload.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaOverload.cpp b/clang/lib/Sema/SemaOverload.cpp index c9c16aafc41..916fe571922 100644 --- a/clang/lib/Sema/SemaOverload.cpp +++ b/clang/lib/Sema/SemaOverload.cpp @@ -3022,6 +3022,12 @@ BuiltinCandidateTypeSet::AddPointerWithMoreQualifiedTypeVariants(QualType Ty, assert(PointerTy && "type was not a pointer type!"); QualType PointeeTy = PointerTy->getPointeeType(); + // Don't add qualified variants of arrays. For one, they're not allowed + // (the qualifier would sink to the element type), and for another, the + // only overload situation where it matters is subscript or pointer +- int, + // and those shouldn't have qualifier variants anyway. + if (PointeeTy->isArrayType()) + return true; unsigned BaseCVR = PointeeTy.getCVRQualifiers(); if (const ConstantArrayType *Array =Context.getAsConstantArrayType(PointeeTy)) BaseCVR = Array->getElementType().getCVRQualifiers(); @@ -3062,6 +3068,12 @@ BuiltinCandidateTypeSet::AddMemberPointerWithMoreQualifiedTypeVariants( assert(PointerTy && "type was not a member pointer type!"); QualType PointeeTy = PointerTy->getPointeeType(); + // Don't add qualified variants of arrays. For one, they're not allowed + // (the qualifier would sink to the element type), and for another, the + // only overload situation where it matters is subscript or pointer +- int, + // and those shouldn't have qualifier variants anyway. + if (PointeeTy->isArrayType()) + return true; const Type *ClassTy = PointerTy->getClass(); // Iterate through all strict supersets of the pointee type's CVR |