{"id":807230,"url":"http://patchwork.ozlabs.org/api/1.2/patches/807230/?format=json","web_url":"http://patchwork.ozlabs.org/project/gcc/patch/CADzB+2=sscZo=kL38X9bGZR9TCdQc0C9cokDOTnhyJsoaxxoUQ@mail.gmail.com/","project":{"id":17,"url":"http://patchwork.ozlabs.org/api/1.2/projects/17/?format=json","name":"GNU Compiler Collection","link_name":"gcc","list_id":"gcc-patches.gcc.gnu.org","list_email":"gcc-patches@gcc.gnu.org","web_url":null,"scm_url":null,"webscm_url":null,"list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<CADzB+2=sscZo=kL38X9bGZR9TCdQc0C9cokDOTnhyJsoaxxoUQ@mail.gmail.com>","list_archive_url":null,"date":"2017-08-29T18:49:13","name":"C++ PATCH to allow copying of local_specializations","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"92a51fac3b344c69d28f25188e0fb58ee3bd4527","submitter":{"id":4337,"url":"http://patchwork.ozlabs.org/api/1.2/people/4337/?format=json","name":"Jason Merrill","email":"jason@redhat.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/gcc/patch/CADzB+2=sscZo=kL38X9bGZR9TCdQc0C9cokDOTnhyJsoaxxoUQ@mail.gmail.com/mbox/","series":[{"id":437,"url":"http://patchwork.ozlabs.org/api/1.2/series/437/?format=json","web_url":"http://patchwork.ozlabs.org/project/gcc/list/?series=437","date":"2017-08-29T18:49:13","name":"C++ PATCH to allow copying of local_specializations","version":1,"mbox":"http://patchwork.ozlabs.org/series/437/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/807230/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/807230/checks/","tags":{},"related":[],"headers":{"Return-Path":"<gcc-patches-return-461109-incoming=patchwork.ozlabs.org@gcc.gnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":["patchwork-incoming@bilbo.ozlabs.org","mailing list gcc-patches@gcc.gnu.org"],"Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org\n\t(client-ip=209.132.180.131; helo=sourceware.org;\n\tenvelope-from=gcc-patches-return-461109-incoming=patchwork.ozlabs.org@gcc.gnu.org;\n\treceiver=<UNKNOWN>)","ozlabs.org; dkim=pass (1024-bit key;\n\tunprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org\n\theader.b=\"ZIVR+TN4\"; dkim-atps=neutral","sourceware.org; auth=none"],"Received":["from sourceware.org (server1.sourceware.org [209.132.180.131])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xhd3l6CWwz9sPt\n\tfor <incoming@patchwork.ozlabs.org>;\n\tWed, 30 Aug 2017 04:49:54 +1000 (AEST)","(qmail 29504 invoked by alias); 29 Aug 2017 18:49:46 -0000","(qmail 29492 invoked by uid 89); 29 Aug 2017 18:49:46 -0000","from mail-io0-f181.google.com (HELO mail-io0-f181.google.com)\n\t(209.85.223.181) by sourceware.org\n\t(qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP;\n\tTue, 29 Aug 2017 18:49:35 +0000","by mail-io0-f181.google.com with SMTP id s101so24627995ioe.0 for\n\t<gcc-patches@gcc.gnu.org>; Tue, 29 Aug 2017 11:49:35 -0700 (PDT)","by 10.107.181.23 with HTTP; Tue, 29 Aug 2017 11:49:13 -0700 (PDT)"],"DomainKey-Signature":"a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id\n\t:list-unsubscribe:list-archive:list-post:list-help:sender\n\t:mime-version:from:date:message-id:subject:to:content-type; q=\n\tdns; s=default; b=O7HFjjz0e0B/a9289qXJcABU6KtCoML+Vxk1KGW+bwcNK2\n\t50Q9VcK5U/fZWgiSNxKQPpjd3DApfzaVqRnB9VT5nBNOAUD96UB9DioHptclLE9M\n\tBE5c1q+NeMNOz+C21q4V3f/Lvr8L9Cht42aCs1gyZFJIfic1biLCNtj67xw7Q=","DKIM-Signature":"v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id\n\t:list-unsubscribe:list-archive:list-post:list-help:sender\n\t:mime-version:from:date:message-id:subject:to:content-type; s=\n\tdefault; bh=i36rAvGT4kOp+mVvpc2BsuzrwPc=; b=ZIVR+TN4BcEdTuZGwlKV\n\txwgNj2XlSozSKf/SvHMhDOPZ3kasl09Ghxs/QBgU81cwZ3a6rBuHOCYjW4jzENyE\n\tqgiFxITEFQcZsNp5FGnBMEBX/ZP0uAtcrneD0qYGDhiQxkSjjk+r0TaLTF//Dfro\n\tMo9ucKo5BbSKy2p9ETBYTRU=","Mailing-List":"contact gcc-patches-help@gcc.gnu.org; run by ezmlm","Precedence":"bulk","List-Id":"<gcc-patches.gcc.gnu.org>","List-Unsubscribe":"<mailto:gcc-patches-unsubscribe-incoming=patchwork.ozlabs.org@gcc.gnu.org>","List-Archive":"<http://gcc.gnu.org/ml/gcc-patches/>","List-Post":"<mailto:gcc-patches@gcc.gnu.org>","List-Help":"<mailto:gcc-patches-help@gcc.gnu.org>","Sender":"gcc-patches-owner@gcc.gnu.org","X-Virus-Found":"No","X-Spam-SWARE-Status":"No, score=-24.1 required=5.0 tests=AWL, BAYES_00,\n\tGIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3,\n\tKAM_LAZY_DOMAIN_SECURITY, RCVD_IN_DNSWL_NONE,\n\tRCVD_IN_SORBS_SPAM autolearn=ham version=3.3.2 spammy=policy","X-HELO":"mail-io0-f181.google.com","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net;\n\ts=20161025;\n\th=x-gm-message-state:mime-version:from:date:message-id:subject:to;\n\tbh=iEaKXRlgt93Kp1xCmHzPVyveqzwy+I/U8ju4Ehys+4o=;\n\tb=LynV0nBFdOKpZSUT495ByvHgkNMzoPw15IYMxyCiMxXIAOj+I2is14jzky7XcdNzkT\n\tm/3F/kteRw8/YP+wwgBtnXbp5RdSg2zzSwOm5vyVbC52rgSXYlRVyhTefdyu0he+IijX\n\tJAGr7jsE3FUMVaFayYMbFbUkmDcPkbbKlQ3ZZo+wK5gfxh85fwlQFWRRsYgBZLZnyXbF\n\tLEo1qIMvBIx+BrfYXFcvAXEaDXj+xR5OQkAm9x+9JsMp3RN11afh4dOkgFhC4k+l3Nwx\n\t+64qsqGmn+Z/0qHrfh+tUZziGtvR0Wxpbl6NwHAVmTJETlmOl0hKJreLdDPJ42+7dRvq\n\tF+PQ==","X-Gm-Message-State":"AHYfb5jQezrV2iaGBgY67YGNIItquZDNCSqs2mk0PBcQSw6Kn11Gqhn8\t4BroQLdryGM8Ej4QGsYvooKOZI9cNfu43Yk=","X-Received":"by 10.107.135.234 with SMTP id\n\tr103mr5181999ioi.328.1504032573880;\n\tTue, 29 Aug 2017 11:49:33 -0700 (PDT)","MIME-Version":"1.0","From":"Jason Merrill <jason@redhat.com>","Date":"Tue, 29 Aug 2017 14:49:13 -0400","Message-ID":"<CADzB+2=sscZo=kL38X9bGZR9TCdQc0C9cokDOTnhyJsoaxxoUQ@mail.gmail.com>","Subject":"C++ PATCH to allow copying of local_specializations","To":"gcc-patches List <gcc-patches@gcc.gnu.org>","Content-Type":"multipart/mixed; boundary=\"001a113fc2b64c31250557e8df8b\"","X-IsSubscribed":"yes"},"content":"When instantiating a lambda-expression in the new model, we want to\nretain the local_specializations from the enclosing function but still\nbe able to remember specializations local to the lambda and discard\nthem afterwards.  With this patch a local_specialization_stack object\ncan start with a copy of the enclosing map.\n\nTested x86_64-pc-linux-gnu, applying to trunk.\ncommit aa72ed613b20715d171287c643f611b7c30b3f12\nAuthor: Jason Merrill <jason@redhat.com>\nDate:   Tue Jul 11 17:32:21 2017 -0400\n\n            Support copying local_specializations.\n    \n            * cp-tree.h (enum lss_policy): New.\n            (local_specialization_stack): Add policy parameter to default ctor.\n            * pt.c (local_specialization_stack): Copy local_specializations if\n            lss_copy.","diff":"diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h\nindex f0eafb3..a58e7bd 100644\n--- a/gcc/cp/cp-tree.h\n+++ b/gcc/cp/cp-tree.h\n@@ -5117,9 +5117,10 @@ enum unification_kind_t {\n // An RAII class used to create a new pointer map for local\n // specializations. When the stack goes out of scope, the\n // previous pointer map is restored.\n+enum lss_policy { lss_blank, lss_copy };\n struct local_specialization_stack\n {\n-  local_specialization_stack ();\n+  local_specialization_stack (lss_policy = lss_blank);\n   ~local_specialization_stack ();\n \n   hash_map<tree, tree> *saved;\ndiff --git a/gcc/cp/pt.c b/gcc/cp/pt.c\nindex 847cd68..416d17b 100644\n--- a/gcc/cp/pt.c\n+++ b/gcc/cp/pt.c\n@@ -77,10 +77,13 @@ static tree cur_stmt_expr;\n //\n // Implementation of the RAII helper for creating new local\n // specializations.\n-local_specialization_stack::local_specialization_stack ()\n+local_specialization_stack::local_specialization_stack (lss_policy policy)\n   : saved (local_specializations)\n {\n-  local_specializations = new hash_map<tree, tree>;\n+  if (policy == lss_blank || !saved)\n+    local_specializations = new hash_map<tree, tree>;\n+  else\n+    local_specializations = new hash_map<tree, tree>(*saved);\n }\n \n local_specialization_stack::~local_specialization_stack ()\n","prefixes":[]}