[Clang][Sema]Choose a better candidate in overload function call if there is a compat...
authorZi Xuan Wu <wuzish@cn.ibm.com>
Fri, 16 Nov 2018 03:00:00 +0000 (03:00 +0000)
committerZi Xuan Wu <wuzish@cn.ibm.com>
Fri, 16 Nov 2018 03:00:00 +0000 (03:00 +0000)
commit64d85a29edd8db3d9fa5421b8c7edb1ed12c0c76
tree2b882b4d55f1df91aec0e970884057c4902ca145
parent6284aee9f811d596b941e44b30dee5befbc22f20
[Clang][Sema]Choose a better candidate in overload function call if there is a compatible vector conversion instead of ambiguous call error

There are 2 function variations with vector type parameter. When we call them with argument of different vector type we would prefer to
choose the variation with implicit argument conversion of compatible vector type instead of incompatible vector type. For example,

typedef float __v4sf __attribute__((__vector_size__(16)));
void f(vector float);
void f(vector signed int);

int main {
   __v4sf a;
   f(a);
}

Here, we'd like to choose f(vector float) but not report an ambiguous call error.

Differential revision: https://reviews.llvm.org/D53417

llvm-svn: 347019
clang/lib/Sema/SemaOverload.cpp
clang/test/Sema/altivec-generic-overload.c [new file with mode: 0644]
clang/test/SemaCXX/vector.cpp