[C++ PATCH] set_global_binding tweak
authorNathan Sidwell <nathan@acm.org>
Tue, 10 Oct 2017 14:48:34 +0000 (14:48 +0000)
committerNathan Sidwell <nathan@gcc.gnu.org>
Tue, 10 Oct 2017 14:48:34 +0000 (14:48 +0000)
https://gcc.gnu.org/ml/gcc-patches/2017-10/msg00592.html
* name-lookup.c (set_global_binding): Don't deal with STAT_HACK.

From-SVN: r253587

gcc/cp/ChangeLog
gcc/cp/name-lookup.c

index 6c92e1b38562ebe83c7e7a213260b4c4b41052b6..082327ed48d97ab99fb9ad6d3c9185679486bebe 100644 (file)
@@ -1,3 +1,7 @@
+2017-10-10  Nathan Sidwell  <nathan@acm.org>
+
+       * name-lookup.c (set_global_binding): Don't deal with STAT_HACK.
+
 2017-10-06  Paolo Carlini  <paolo.carlini@oracle.com>
 
        PR c++/47791
index a3da34d7549c8f44c6e936b33dc58be5440e6a94..ae30cf96b9118d3de6395621ebd8232e03ec6f1a 100644 (file)
@@ -4858,22 +4858,13 @@ set_global_binding (tree decl)
   bool subtime = timevar_cond_start (TV_NAME_LOOKUP);
 
   tree *slot = find_namespace_slot (global_namespace, DECL_NAME (decl), true);
-  tree old = MAYBE_STAT_DECL (*slot);
 
-  if (!old)
-    *slot = decl;
-  else if (old == decl)
-    ;
-  else if (!STAT_HACK_P (*slot)
-          && TREE_CODE (decl) == TYPE_DECL && DECL_ARTIFICIAL (decl))
-    *slot = stat_hack (old, decl);
-  else if (!STAT_HACK_P (*slot)
-          && TREE_CODE (old) == TYPE_DECL && DECL_ARTIFICIAL (old))
-    *slot = stat_hack (decl, old);
-  else
-    /* The user's placed something in the implementor's
-       namespace.  */
-    diagnose_name_conflict (decl, old);
+  if (*slot)
+    /* The user's placed something in the implementor's namespace.  */
+    diagnose_name_conflict (decl, MAYBE_STAT_DECL (*slot));
+
+  /* Force the binding, so compiler internals continue to work.  */
+  *slot = decl;
 
   timevar_cond_stop (TV_NAME_LOOKUP, subtime);
 }