aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaTemplateInstantiateDecl.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2011-06-21 23:42:09 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2011-06-21 23:42:09 +0000
commite3499cae8e5323ac553ad56977bf1cd42b9a5a35 (patch)
treeb765e3dcfd1e84cd2c6f544a1794b526e88409fe /lib/Sema/SemaTemplateInstantiateDecl.cpp
parent0894976ba1384a34357e333846adedc6a42334fd (diff)
Fix PR10168: don't warn for unused non-dependent variables in both the template definition and each instantiation.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133580 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaTemplateInstantiateDecl.cpp')
-rw-r--r--lib/Sema/SemaTemplateInstantiateDecl.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/Sema/SemaTemplateInstantiateDecl.cpp b/lib/Sema/SemaTemplateInstantiateDecl.cpp
index e78aa2991e..cc66ec6759 100644
--- a/lib/Sema/SemaTemplateInstantiateDecl.cpp
+++ b/lib/Sema/SemaTemplateInstantiateDecl.cpp
@@ -415,8 +415,10 @@ Decl *TemplateDeclInstantiator::VisitVarDecl(VarDecl *D) {
!Var->isCXXForRangeDecl())
SemaRef.ActOnUninitializedDecl(Var, false);
- // Diagnose unused local variables.
- if (!Var->isInvalidDecl() && Owner->isFunctionOrMethod() && !Var->isUsed())
+ // Diagnose unused local variables with dependent types, where the diagnostic
+ // will have been deferred.
+ if (!Var->isInvalidDecl() && Owner->isFunctionOrMethod() && !Var->isUsed() &&
+ D->getType()->isDependentType())
SemaRef.DiagnoseUnusedDecl(Var);
return Var;