summaryrefslogtreecommitdiffstats
path: root/test/SemaCXX/vector.cpp
diff options
context:
space:
mode:
authorZi Xuan Wu <wuzish@cn.ibm.com>2018-11-16 03:00:00 +0000
committerZi Xuan Wu <wuzish@cn.ibm.com>2018-11-16 03:00:00 +0000
commitfbbf9d4aee2f9dae4253180be19ceb7a271af65f (patch)
tree7f6b8df83c6bc7b70bccb52dd6a368e07605e61b /test/SemaCXX/vector.cpp
parent30a86941b0515629cdac77d4ef8078422e6fe706 (diff)
[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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@347019 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaCXX/vector.cpp')
-rw-r--r--test/SemaCXX/vector.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/test/SemaCXX/vector.cpp b/test/SemaCXX/vector.cpp
index 56a8a6db5b..a6a4ceb0e5 100644
--- a/test/SemaCXX/vector.cpp
+++ b/test/SemaCXX/vector.cpp
@@ -17,14 +17,14 @@ void f0_test(char16 c16, longlong16 ll16, char16_e c16e, longlong16_e ll16e) {
f0(ll16e);
}
-int &f1(char16); // expected-note 2{{candidate function}}
-float &f1(longlong16); // expected-note 2{{candidate function}}
+int &f1(char16);
+float &f1(longlong16);
void f1_test(char16 c16, longlong16 ll16, char16_e c16e, longlong16_e ll16e) {
int &ir1 = f1(c16);
float &fr1 = f1(ll16);
- f1(c16e); // expected-error{{call to 'f1' is ambiguous}}
- f1(ll16e); // expected-error{{call to 'f1' is ambiguous}}
+ int &ir2 = f1(c16e);
+ float &fr2 = f1(ll16e);
}
void f2(char16_e); // expected-note{{no known conversion from 'longlong16_e' (vector of 2 'long long' values) to 'char16_e' (vector of 16 'char' values) for 1st argument}} \