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/lib/Sema/TreeTransform.h b/lib/Sema/TreeTransform.h
index 03169bf..8c84d4a 100644
--- a/lib/Sema/TreeTransform.h
+++ b/lib/Sema/TreeTransform.h
@@ -3688,8 +3688,13 @@
Base.get() == E->getBase() &&
Qualifier == E->getQualifier() &&
Member == E->getMemberDecl() &&
- !E->hasExplicitTemplateArgumentList())
+ !E->hasExplicitTemplateArgumentList()) {
+
+ // Mark it referenced in the new context regardless.
+ // FIXME: this is a bit instantiation-specific.
+ SemaRef.MarkDeclarationReferenced(E->getMemberLoc(), Member);
return SemaRef.Owned(E->Retain());
+ }
TemplateArgumentListInfo TransArgs;
if (E->hasExplicitTemplateArgumentList()) {