Author: akirtzidis
Date: Thu Nov  4 03:48:52 2010
New Revision: 118239

URL: http://llvm.org/viewvc/llvm-project?rev=118239&view=rev
Log:
Don't be so eager to replace UsingDecls in a DeclContext's lookup table;
check that the TargetNestedNameDecl is the same first.

Modified:
    cfe/trunk/lib/AST/Decl.cpp
    cfe/trunk/test/SemaCXX/using-decl-templates.cpp

Modified: cfe/trunk/lib/AST/Decl.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Decl.cpp?rev=118239&r1=118238&r2=118239&view=diff
==============================================================================
--- cfe/trunk/lib/AST/Decl.cpp (original)
+++ cfe/trunk/lib/AST/Decl.cpp Thu Nov  4 03:48:52 2010
@@ -732,6 +732,10 @@
     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.

Modified: cfe/trunk/test/SemaCXX/using-decl-templates.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/using-decl-templates.cpp?rev=118239&r1=118238&r2=118239&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/using-decl-templates.cpp (original)
+++ cfe/trunk/test/SemaCXX/using-decl-templates.cpp Thu Nov  4 03:48:52 2010
@@ -45,3 +45,21 @@
 
   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();
+}


_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to