This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [C++1y] [PATCH 1/4] Use translation-unit-global rather than parameter-list-local counter for generic type names to facilitate nested implicit function templates.
- From: Jason Merrill <jason at redhat dot com>
- To: Adam Butcher <adam at jessamine dot co dot uk>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Sun, 22 Sep 2013 14:32:58 -0400 (EDT)
- Subject: Re: [C++1y] [PATCH 1/4] Use translation-unit-global rather than parameter-list-local counter for generic type names to facilitate nested implicit function templates.
- Authentication-results: sourceware.org; auth=none
- References: <1379615867-21555-1-git-send-email-adam at jessamine dot co dot uk> <1379615867-21555-2-git-send-email-adam at jessamine dot co dot uk> <523C89DF dot 2080706 at redhat dot com> <8cc60b80eb233f0314e889da4d1861ac at imap dot force9 dot net>
OK.
-------- Original Message --------
From: Adam Butcher <adam@jessamine.co.uk>
Sent: Sun, Sep 22, 2013 08:41 AM
To: Jason Merrill <jason@redhat.com>
CC: gcc-patches@gcc.gnu.org
Subject: Re: [C++1y] [PATCH 1/4] Use translation-unit-global rather than parameter-list-local counter for generic type names to facilitate nested implicit function templates.
On 20.09.2013 18:46, Jason Merrill wrote:
> On 09/19/2013 02:37 PM, Adam Butcher wrote:
>> + static int i = 0;
>
> I think this needs to be global and GTY so that it works properly
> with PCH.
>
Didn't consider PCH. This delta OK?
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -28897,12 +28897,12 @@ c_parse_file (void)
/* Create an identifier for a generic parameter type (a synthesized
template parameter implied by `auto' or a concept identifier). */
+static GTY(()) int generic_parm_count;
static tree
make_generic_type_name ()
{
char buf[32];
- static int i = 0;
- sprintf (buf, "<auto%d>", ++i);
+ sprintf (buf, "<auto%d>", ++generic_parm_count);
return get_identifier (buf);
}