diff options
author | Douglas Gregor <dgregor@apple.com> | 2009-06-17 23:37:01 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2009-06-17 23:37:01 +0000 |
commit | f187420feb5429f97533cac1e160d08c2b9cb47a (patch) | |
tree | d78bf394ad70392fdad746ab08f7b37c2a3e85ea /clang/lib/Sema/SemaDecl.cpp | |
parent | 4dd5b57ef43f17a65abe7e8c246bf30f96648e0c (diff) | |
download | bcm5719-llvm-f187420feb5429f97533cac1e160d08c2b9cb47a.tar.gz bcm5719-llvm-f187420feb5429f97533cac1e160d08c2b9cb47a.zip |
Diagnose class members that shadow a template parameter. Fixes
<rdar://problem/6952203>.
To do this, we actually remove a not-quite-correct optimization in the
C++ name lookup routines. We'll revisit this optimization for the
general case once more C++ is working.
llvm-svn: 73659
Diffstat (limited to 'clang/lib/Sema/SemaDecl.cpp')
-rw-r--r-- | clang/lib/Sema/SemaDecl.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index 3c6f706f158..77460359f49 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -3807,6 +3807,14 @@ FieldDecl *Sema::HandleField(Scope *S, RecordDecl *Record, Diag(D.getDeclSpec().getThreadSpecLoc(), diag::err_invalid_thread); NamedDecl *PrevDecl = LookupName(S, II, LookupMemberName, true); + + if (PrevDecl && PrevDecl->isTemplateParameter()) { + // Maybe we will complain about the shadowed template parameter. + DiagnoseTemplateParameterShadow(D.getIdentifierLoc(), PrevDecl); + // Just pretend that we didn't see the previous declaration. + PrevDecl = 0; + } + if (PrevDecl && !isDeclInScope(PrevDecl, Record, S)) PrevDecl = 0; |