public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [C++ PATCH] Overload pushing cleanup
@ 2017-01-11 20:13 Nathan Sidwell
  0 siblings, 0 replies; only message in thread
From: Nathan Sidwell @ 2017-01-11 20:13 UTC (permalink / raw)
  To: GCC Patches; +Cc: Jason Merrill

[-- Attachment #1: Type: text/plain, Size: 287 bytes --]

In fixing 77812, a name lookup bug, I got confused by the overload 
creation code, which seemed a bit complex.  This simplifies it by 
clearly separating the optional wrapping of a single decl from the 
subsequent prepending of the new decl.

applied to trunk

nathan
-- 
Nathan Sidwell

[-- Attachment #2: ovl-clean.diff --]
[-- Type: text/x-patch, Size: 783 bytes --]

2017-01-11  Nathan Sidwell  <nathan@acm.org>

	* name-lookup.c (push_overloaded_decl_1): Refactor OVERLOAD creation.

Index: cp/name-lookup.c
===================================================================
--- cp/name-lookup.c	(revision 244314)
+++ cp/name-lookup.c	(working copy)
@@ -2454,9 +2454,11 @@ push_overloaded_decl_1 (tree decl, int f
       || (flags & PUSH_USING))
     {
       if (old && TREE_CODE (old) != OVERLOAD)
-	new_binding = ovl_cons (decl, ovl_cons (old, NULL_TREE));
+	/* Wrap the existing single decl in an overload.  */
+	new_binding = ovl_cons (old, NULL_TREE);
       else
-	new_binding = ovl_cons (decl, old);
+	new_binding = old;
+      new_binding = ovl_cons (decl, new_binding);
       if (flags & PUSH_USING)
 	OVL_USED (new_binding) = 1;
     }

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-01-11 20:13 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-11 20:13 [C++ PATCH] Overload pushing cleanup Nathan Sidwell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).