diff options
Diffstat (limited to 'clang')
| -rw-r--r-- | clang/lib/AST/Decl.cpp | 4 | ||||
| -rw-r--r-- | clang/test/SemaCXX/using-decl-templates.cpp | 18 |
2 files changed, 22 insertions, 0 deletions
diff --git a/clang/lib/AST/Decl.cpp b/clang/lib/AST/Decl.cpp index ca963ad7e59..c6c7649bdac 100644 --- a/clang/lib/AST/Decl.cpp +++ b/clang/lib/AST/Decl.cpp @@ -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. diff --git a/clang/test/SemaCXX/using-decl-templates.cpp b/clang/test/SemaCXX/using-decl-templates.cpp index 5148ed5bcc7..7b4da9d50d0 100644 --- a/clang/test/SemaCXX/using-decl-templates.cpp +++ b/clang/test/SemaCXX/using-decl-templates.cpp @@ -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(); +} |

