[PATCH] D31187: Fix removal of out-of-line definitions.

Vassil Vassilev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 21 06:37:08 PDT 2017


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) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D31187.92480.patch
Type: text/x-patch
Size: 402 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170321/7427c017/attachment.bin>


More information about the cfe-commits mailing list