summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2013-09-21 21:55:46 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2013-09-21 21:55:46 +0000
commit089c31637f86a97a2cc4f309c7d46ebf5f0ddb8c (patch)
treef2ae1df8047a65d0ab7c05a097c1e41fa6041c11 /clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
parent4e9c091dd72b6ec221d71eb928c99f099f5aff41 (diff)
downloadbcm5719-llvm-089c31637f86a97a2cc4f309c7d46ebf5f0ddb8c.tar.gz
bcm5719-llvm-089c31637f86a97a2cc4f309c7d46ebf5f0ddb8c.zip
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. llvm-svn: 191150
Diffstat (limited to 'clang/lib/Sema/SemaTemplateInstantiateDecl.cpp')
-rw-r--r--clang/lib/Sema/SemaTemplateInstantiateDecl.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
index e03e8c55c9a..d712cec2204 100644
--- a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
+++ b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
@@ -3372,7 +3372,9 @@ void Sema::BuildVariableInstantiation(
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());
}
OpenPOWER on IntegriCloud