Check compatibility of vector types using their canonicalizations.

Fixes an assertion arising C overload analysis, but really I can't imagine
that this wouldn't cause a thousand other uncaught failures.

Fixes PR6600.

llvm-svn: 98400
This commit is contained in:
John McCall 2010-03-12 23:14:13 +00:00
parent f6442f80cb
commit 44c064be73
2 changed files with 12 additions and 2 deletions

View File

@ -4736,7 +4736,8 @@ QualType ASTContext::mergeTypes(QualType LHS, QualType RHS) {
return QualType();
case Type::Vector:
// FIXME: The merged type should be an ExtVector!
if (areCompatVectorTypes(LHS->getAs<VectorType>(), RHS->getAs<VectorType>()))
if (areCompatVectorTypes(LHSCan->getAs<VectorType>(),
RHSCan->getAs<VectorType>()))
return LHS;
return QualType();
case Type::ObjCInterface: {

View File

@ -50,4 +50,13 @@ void test_promote(short* sp) {
promote(sp); // expected-error{{call to unavailable function 'promote'}}
}
// PR6600
typedef double Double;
typedef Double DoubleVec __attribute__((vector_size(16)));
typedef int Int;
typedef Int IntVec __attribute__((vector_size(16)));
double magnitude(DoubleVec) __attribute__((__overloadable__));
double magnitude(IntVec) __attribute__((__overloadable__));
double test_p6600(DoubleVec d) {
return magnitude(d) * magnitude(d);
}