PR17295: Do not allow explicit conversion functions to be used in cases where
an additional conversion (other than a qualification conversion) would be
required after the explicit conversion.
Conversely, do allow explicit conversion functions to be used when initializing
a temporary for a reference binding in direct-list-initialization.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@191150 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaTemplateInstantiateDecl.cpp b/lib/Sema/SemaTemplateInstantiateDecl.cpp
index e03e8c5..d712cec 100644
--- a/lib/Sema/SemaTemplateInstantiateDecl.cpp
+++ b/lib/Sema/SemaTemplateInstantiateDecl.cpp
@@ -3372,7 +3372,9 @@
OldVar->isPreviousDeclInSameBlockScope());
NewVar->setAccess(OldVar->getAccess());
- if (!OldVar->isStaticDataMember()) {
+ // For local variables, inherit the 'used' and 'referenced' flags from the
+ // primary template.
+ if (OldVar->getLexicalDeclContext()->isFunctionOrMethod()) {
NewVar->setIsUsed(OldVar->isUsed(false));
NewVar->setReferenced(OldVar->isReferenced());
}