Don't be so eager to replace UsingDecls in a DeclContext's lookup table;

check that the TargetNestedNameDecl is the same first.

llvm-svn: 118239
This commit is contained in:
Argyrios Kyrtzidis 2010-11-04 08:48:52 +00:00
parent ba37e1eb49
commit 4b52007c35
2 changed files with 22 additions and 0 deletions

View File

@ -732,6 +732,10 @@ bool NamedDecl::declarationReplaces(NamedDecl *OldD) const {
return cast<UsingShadowDecl>(this)->getTargetDecl() ==
cast<UsingShadowDecl>(OldD)->getTargetDecl();
if (isa<UsingDecl>(this) && isa<UsingDecl>(OldD))
return cast<UsingDecl>(this)->getTargetNestedNameDecl() ==
cast<UsingDecl>(OldD)->getTargetNestedNameDecl();
// For non-function declarations, if the declarations are of the
// same kind then this must be a redeclaration, or semantic analysis
// would not have given us the new declaration.

View File

@ -45,3 +45,21 @@ namespace test0 {
template struct E<int>;
}
// PR7896
namespace PR7896 {
template <class T> struct Foo {
int k (float);
};
struct Baz {
int k (int);
};
template <class T> struct Bar : public Foo<T>, Baz {
using Foo<T>::k;
using Baz::k;
int foo() {
return k (1.0f);
}
};
template int Bar<int>::foo();
}