PR17592: Ensure we diagnose shadowing a template parameter with a local extern
declaration.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@192846 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaLookup.cpp b/lib/Sema/SemaLookup.cpp
index 6185e23..3029283 100644
--- a/lib/Sema/SemaLookup.cpp
+++ b/lib/Sema/SemaLookup.cpp
@@ -930,8 +930,10 @@
LeftStartingScope = true;
// If we found something outside of our starting scope that
- // does not have linkage, skip it.
- if (LeftStartingScope && !((*I)->hasLinkage())) {
+ // does not have linkage, skip it. If it's a template parameter,
+ // we still find it, so we can diagnose the invalid redeclaration.
+ if (LeftStartingScope && !((*I)->hasLinkage()) &&
+ !(*I)->isTemplateParameter()) {
R.setShadowed();
continue;
}