Used visible conversion function api to do overload
resolution of type conversion functions in base and
current class.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81784 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/CodeGenCXX/conversion-function.cpp b/test/CodeGenCXX/conversion-function.cpp
index 0d21180..e5f303c 100644
--- a/test/CodeGenCXX/conversion-function.cpp
+++ b/test/CodeGenCXX/conversion-function.cpp
@@ -77,12 +77,31 @@
   g(o1, o2);
 }
 
+// Test. Conversion in base class is visible in derived class.
+class XB {
+public:
+  operator int();
+};
+
+class Yb : public XB {
+public:
+  operator char();
+};
+
+void f(Yb& a) {
+  int i = a; // OK. calls XB::operator int();
+  char ch = a;  // OK. calls Yb::operator char();
+}
+
+
 // CHECK-LP64: .globl __ZN1ScviEv
 // CHECK-LP64-NEXT: __ZN1ScviEv:
 // CHECK-LP64: call __ZN1Ycv1ZEv
 // CHECK-LP64: call __ZN1Zcv1XEv
 // CHECK-LP64: call __ZN1XcviEv
 // CHECK-LP64: call __ZN1XcvfEv
+// CHECK-LP64: call __ZN2XBcviEv
+// CHECK-LP64: call __ZN2YbcvcEv
 
 // CHECK-LP32: .globl  __ZN1ScviEv
 // CHECK-LP32-NEXT: __ZN1ScviEv:
@@ -90,3 +109,5 @@
 // CHECK-LP32: call L__ZN1Zcv1XEv
 // CHECK-LP32: call L__ZN1XcviEv
 // CHECK-LP32: call L__ZN1XcvfEv
+// CHECK-LP32: call L__ZN2XBcviEv
+// CHECK-LP32: call L__ZN2YbcvcEv
diff --git a/test/SemaCXX/conversion-function.cpp b/test/SemaCXX/conversion-function.cpp
index cde2851..37ffc1b 100644
--- a/test/SemaCXX/conversion-function.cpp
+++ b/test/SemaCXX/conversion-function.cpp
@@ -75,3 +75,21 @@
 void f(const C& c) {
   const char* v = c;
 }
+
+// Test. Conversion in base class is visible in derived class.
+class XB { 
+public:
+  operator int();
+};
+
+class Yb : public XB { 
+public:
+  operator char();
+};
+
+void f(Yb& a) {
+  if (a) { } // expected-error {{value of type 'class Yb' is not contextually convertible to 'bool'}}
+  int i = a; // OK. calls XB::operator int();
+  char ch = a;  // OK. calls Yb::operator char();
+}
+