When we simply return a retained member expression when instantiating, we must also mark the member decl as referenced.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91887 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/SemaTemplate/instantiate-member-expr.cpp b/test/SemaTemplate/instantiate-member-expr.cpp
new file mode 100644
index 0000000..db13624
--- /dev/null
+++ b/test/SemaTemplate/instantiate-member-expr.cpp
@@ -0,0 +1,27 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+template<typename T>
+struct S {
+ S() { }
+};
+
+template<typename T>
+struct vector {
+  void push_back(const T&) { int a[sizeof(T) ? -1: -1]; } // expected-error {{array size is negative}}
+};
+
+class GRExprEngine {
+public:
+ typedef vector<S<void *> >CheckersOrdered;
+ CheckersOrdered Checkers;
+
+ template <typename CHECKER>
+ void registerCheck(CHECKER *check) {
+   Checkers.push_back(S<void *>()); // expected-note {{in instantiation of member function 'vector<struct S<void *> >::push_back' requested here}}
+ }
+};
+
+class RetainReleaseChecker { };
+
+void f(GRExprEngine& Eng) {
+   Eng.registerCheck(new RetainReleaseChecker); // expected-note {{in instantiation of function template specialization 'GRExprEngine::registerCheck<class RetainReleaseChecker>' requested here}}
+}