[llvm-branch-commits] [cfe-branch] r118556 - in /cfe/branches/Apple/whitney: lib/AST/Decl.cpp test/SemaCXX/using-decl-templates.cpp

Daniel Dunbar daniel at zuster.org
Tue Nov 9 09:31:41 PST 2010


Author: ddunbar
Date: Tue Nov  9 11:31:41 2010
New Revision: 118556

URL: http://llvm.org/viewvc/llvm-project?rev=118556&view=rev
Log:
Merge r118239:
--
Author: Argyrios Kyrtzidis <akyrtzi at gmail.com>
Date:   Thu Nov 4 08:48:52 2010 +0000

    Don't be so eager to replace UsingDecls in a DeclContext's lookup table;
    check that the TargetNestedNameDecl is the same first.

Modified:
    cfe/branches/Apple/whitney/lib/AST/Decl.cpp
    cfe/branches/Apple/whitney/test/SemaCXX/using-decl-templates.cpp

Modified: cfe/branches/Apple/whitney/lib/AST/Decl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/whitney/lib/AST/Decl.cpp?rev=118556&r1=118555&r2=118556&view=diff
==============================================================================
--- cfe/branches/Apple/whitney/lib/AST/Decl.cpp (original)
+++ cfe/branches/Apple/whitney/lib/AST/Decl.cpp Tue Nov  9 11:31:41 2010
@@ -716,6 +716,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/branches/Apple/whitney/test/SemaCXX/using-decl-templates.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/whitney/test/SemaCXX/using-decl-templates.cpp?rev=118556&r1=118555&r2=118556&view=diff
==============================================================================
--- cfe/branches/Apple/whitney/test/SemaCXX/using-decl-templates.cpp (original)
+++ cfe/branches/Apple/whitney/test/SemaCXX/using-decl-templates.cpp Tue Nov  9 11:31:41 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();
+}





More information about the llvm-branch-commits mailing list