Implement ranking of standard conversion sequences by their qualification
conversions (e.g., comparing int* -> const int* against
int* -> const volatile int*); see C++ 13.3.3.2p3 bullet 3.
Add Sema::UnwrapSimilarPointerTypes to simplify the control flow of
IsQualificationConversion and CompareQualificationConversion (and fix
the handling of the int* -> volatile int* conversion in the former).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57978 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/SemaCXX/overload-call.cpp b/test/SemaCXX/overload-call.cpp
index 165ee60..3036e67 100644
--- a/test/SemaCXX/overload-call.cpp
+++ b/test/SemaCXX/overload-call.cpp
@@ -156,11 +156,32 @@
// Test overloading based on qualification ranking (C++ 13.3.2)p3.
int* quals_rank1(int const * p);
float* quals_rank1(int const volatile *p);
+char* quals_rank1(char*);
+double* quals_rank1(const char*);
int* quals_rank2(int const * const * pp);
float* quals_rank2(int * const * pp);
+void quals_rank3(int const * const * const volatile * p); // expected-note{{candidate function}}
+void quals_rank3(int const * const volatile * const * p); // expected-note{{candidate function}}
+
+void quals_rank3(int const *); // expected-note{{candidate function}}
+void quals_rank3(int volatile *); // expected-note{{candidate function}}
+
void test_quals_ranking(int * p, int volatile *pq, int * * pp, int * * * ppp) {
- // int* q1 = quals_rank1(p);
+ int* q1 = quals_rank1(p);
float* q2 = quals_rank1(pq);
+ double* q3 = quals_rank1("string literal");
+ char a[17];
+ const char* ap = a;
+ char* q4 = quals_rank1(a);
+ double* q5 = quals_rank1(ap);
+
+ float* q6 = quals_rank2(pp);
+
+ quals_rank3(ppp); // expected-error {{call to 'quals_rank3' is ambiguous; candidates are:}}
+
+ quals_rank3(p); // expected-error {{call to 'quals_rank3' is ambiguous; candidates are:}}
+ quals_rank3(pq);
}
+