Require a complete type before examining base classes during template argument
deduction. This requires refactoring the deduction to have access to the Sema
object instead of merely the ASTContext. Still leaves something to be desired
due to poor source location.

Fixes PR6257 and half of PR6259.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95528 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/SemaTemplate/deduction.cpp b/test/SemaTemplate/deduction.cpp
index 375d199..8d00bb7 100644
--- a/test/SemaTemplate/deduction.cpp
+++ b/test/SemaTemplate/deduction.cpp
@@ -86,3 +86,15 @@
 template <typename T, int N> void f(const T (&a)[N]);
 int iarr[] = { 1 };
 void test_PR5911() { f(iarr); }
+
+// Must not examine base classes of incomplete type during template argument
+// deduction.
+namespace PR6257 {
+  template <typename T> struct X {
+    template <typename U> X(const X<U>& u);
+  };
+  struct A;
+  void f(A& a);
+  void f(const X<A>& a);
+  void test(A& a) { (void)f(a); }
+}