A couple minor fixes to template instantiation for for-range loops.

llvm-svn: 149440
diff --git a/clang/test/SemaCXX/for-range-examples.cpp b/clang/test/SemaCXX/for-range-examples.cpp
index dd35603..868de9d 100644
--- a/clang/test/SemaCXX/for-range-examples.cpp
+++ b/clang/test/SemaCXX/for-range-examples.cpp
@@ -158,3 +158,14 @@
     for (int x : a.xs) { } // expected-error {{'xs' is a private member of 'test2::A'}}
   }
 }
+
+namespace test3 {
+  // Make sure this doesn't crash
+  struct A {};
+  struct B { ~B(); operator bool(); };
+  struct C { B operator!=(const C&); C& operator++(); int operator*(); };
+  C begin(const A&);
+  C end(const A&);
+  template<typename T> void f() { for (auto a : A()) {} }
+  void g() { f<int>(); }
+}