v.g.vassilev created this revision.

Consider:

`
struct MyClass {

  void f() {}

}
MyClass::f(){} // expected error redefinition of f.
`

The routine fails to remove the lookup entry is registered in the semantic decl 
context and not in the primary decl context of the lexical decl context where 
we currently are trying to remove it from.


Repository:
  rL LLVM

https://reviews.llvm.org/D31187

Files:
  lib/AST/DeclBase.cpp


Index: lib/AST/DeclBase.cpp
===================================================================
--- lib/AST/DeclBase.cpp
+++ lib/AST/DeclBase.cpp
@@ -1254,7 +1254,7 @@
     // Remove only decls that have a name
     if (!ND->getDeclName()) return;
 
-    auto *DC = this;
+    auto *DC = D->getDeclContext();
     do {
       StoredDeclsMap *Map = DC->getPrimaryContext()->LookupPtr;
       if (Map) {


Index: lib/AST/DeclBase.cpp
===================================================================
--- lib/AST/DeclBase.cpp
+++ lib/AST/DeclBase.cpp
@@ -1254,7 +1254,7 @@
     // Remove only decls that have a name
     if (!ND->getDeclName()) return;
 
-    auto *DC = this;
+    auto *DC = D->getDeclContext();
     do {
       StoredDeclsMap *Map = DC->getPrimaryContext()->LookupPtr;
       if (Map) {
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to