[Sema] Fix a crash in access checking for deduction guides

Summary: See the added test for a repro.

Reviewers: sammccall

Reviewed By: sammccall

Subscribers: cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D58111

llvm-svn: 353840
diff --git a/clang/test/Sema/crash-deduction-guide-access.cpp b/clang/test/Sema/crash-deduction-guide-access.cpp
new file mode 100644
index 0000000..c0203ef
--- /dev/null
+++ b/clang/test/Sema/crash-deduction-guide-access.cpp
@@ -0,0 +1,11 @@
+// RUN: not %clang_cc1 -x c++ -std=c++17 -fsyntax-only %s
+template <typename U>
+class Imp {
+  template <typename F>
+  explicit Imp(F f);
+};
+
+template <typename T>
+class Cls {
+  explicit Imp() : f() {}
+};