aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2010-03-12 23:14:13 +0000
committerJohn McCall <rjmccall@apple.com>2010-03-12 23:14:13 +0000
commit1c471f3e1c0ec8cbc82447bb35908dfc55463e46 (patch)
tree3f5d4e02b1aeb37259ec404accf7754e14a906a0
parent3352406820d133c78161e8d710f95b8ac152a1e7 (diff)
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98400 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/AST/ASTContext.cpp3
-rw-r--r--test/Sema/overloadable.c11
2 files changed, 12 insertions, 2 deletions
diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp
index ea121165fc..c64f97a97f 100644
--- a/lib/AST/ASTContext.cpp
+++ b/lib/AST/ASTContext.cpp
@@ -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: {
diff --git a/test/Sema/overloadable.c b/test/Sema/overloadable.c
index ff631ed9c8..28c3e4cf8c 100644
--- a/test/Sema/overloadable.c
+++ b/test/Sema/overloadable.c
@@ -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);
+}