{"id":810771,"url":"http://patchwork.ozlabs.org/api/patches/810771/?format=json","web_url":"http://patchwork.ozlabs.org/project/gcc/patch/CADzB+2mTHE4qv7o1j=TMph1OcBYEEfooZxayT39Zx7wcY58D7w@mail.gmail.com/","project":{"id":17,"url":"http://patchwork.ozlabs.org/api/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+2mTHE4qv7o1j=TMph1OcBYEEfooZxayT39Zx7wcY58D7w@mail.gmail.com>","list_archive_url":null,"date":"2017-09-06T18:56:56","name":"C++ PATCH for c++/82070, error with nested lambda capture","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"c9fffe6df1bcd81deb72460cad5f3ca6ac0f5ff5","submitter":{"id":4337,"url":"http://patchwork.ozlabs.org/api/people/4337/?format=json","name":"Jason Merrill","email":"jason@redhat.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/gcc/patch/CADzB+2mTHE4qv7o1j=TMph1OcBYEEfooZxayT39Zx7wcY58D7w@mail.gmail.com/mbox/","series":[{"id":1867,"url":"http://patchwork.ozlabs.org/api/series/1867/?format=json","web_url":"http://patchwork.ozlabs.org/project/gcc/list/?series=1867","date":"2017-09-06T18:56:56","name":"C++ PATCH for c++/82070, error with nested lambda capture","version":1,"mbox":"http://patchwork.ozlabs.org/series/1867/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/810771/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/810771/checks/","tags":{},"related":[],"headers":{"Return-Path":"<gcc-patches-return-461640-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-461640-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=\"WgY2Eqc1\"; 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 3xnXrs0x26z9sRV\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu,  7 Sep 2017 04:57:30 +1000 (AEST)","(qmail 65013 invoked by alias); 6 Sep 2017 18:57:21 -0000","(qmail 63962 invoked by uid 89); 6 Sep 2017 18:57:20 -0000","from mail-io0-f170.google.com (HELO mail-io0-f170.google.com)\n\t(209.85.223.170) by sourceware.org\n\t(qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP;\n\tWed, 06 Sep 2017 18:57:19 +0000","by mail-io0-f170.google.com with SMTP id d16so278722ioj.3 for\n\t<gcc-patches@gcc.gnu.org>; Wed, 06 Sep 2017 11:57:18 -0700 (PDT)","by 10.107.181.23 with HTTP; Wed, 6 Sep 2017 11:56:56 -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=Ga6RHYZi6wjCQzr/12vIuiQqeUfBN3+ftFslq0q+SUN2yi\n\tWd4E8pITEILacFlnxUuDr233ZOeThox2/RR8eu+SnlINInobIwMFRBJjp+w4L0v9\n\tGLypehQoEq6D68qpwYt0Gj9pIb+PSYVX+vMLN4LVKQJLTHE/6ETPI7NddjG94=","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=LpbXLW021I49aUAhd7RoVP46NOc=; b=WgY2Eqc1JOEsXhv9FgWJ\n\ty7Qyc1dtH8Lt2MXaWnYB+eoh4UDE5PVRG0JX2Nle/ckdVqBhMm40uTjNr9UkeR09\n\t5pClcpx/Hcu07E/GdsK8lQdaC6HZ2PPYBy/IWGoUPk77YnrbC+/RE0u5ykoZ5AcD\n\tsuzElgT3ch80WQBtKItI4bw=","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=-25.0 required=5.0 tests=AWL, BAYES_00,\n\tGIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3,\n\tRCVD_IN_DNSWL_NONE,\n\tRCVD_IN_SORBS_SPAM autolearn=ham version=3.3.2 spammy=proxies","X-HELO":"mail-io0-f170.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=WqQlJMoSCQ71V3/etksFuA1aJNFDZ1JI45dsFAbc/s0=;\n\tb=RuOjAp1UTfJhNE1SLwwZawXuG9kFmEIEn65yttHkQfHGelSb32awTVEwCYMpFi9/f9\n\tzDqCsoMhwCsuWspTtPl3na8DHsXLKnVq1bvVW0FJdFQbEjey09w6hcTRA1Q6WeWzIUBG\n\tzHEYkbh/od2JNUg85tfEsnKhdoWE4kePLMjSkCOiwyqZjesvEvlDaYMZ3g9yE38lhK0d\n\teFDfI0OPWfcdmTSYeX4HLT8DYre4ofn91OxBrEpWLqp/5W/rWby3S1l5mqNI4BY++/1c\n\tkFwtsV3iG49pOodMTHvADjonpbcDxj/L6GDca/cPGVM2khzGIkZMFYozgy9crxrxkYIN\n\tGCMA==","X-Gm-Message-State":"AHPjjUjhZF+fqacU/vPV7JyseOaFN4erEDhY5setNVU2Trlq1vxzU4N+\tAYXvqyRS0l5q/STVIC1eE8MjvF7mDfb1dv4=","X-Google-Smtp-Source":"AOwi7QBLDluH5lBaOHSv43KQ6XXY/1kkpR3plP2LLpvOD3wz3oGXLAww/n741MLH4WXHztYuOmwTaRrntNbN59bbyOQ=","X-Received":"by 10.107.69.1 with SMTP id s1mr145790ioa.147.1504724236863;\n\tWed, 06 Sep 2017 11:57:16 -0700 (PDT)","MIME-Version":"1.0","From":"Jason Merrill <jason@redhat.com>","Date":"Wed, 6 Sep 2017 14:56:56 -0400","Message-ID":"<CADzB+2mTHE4qv7o1j=TMph1OcBYEEfooZxayT39Zx7wcY58D7w@mail.gmail.com>","Subject":"C++ PATCH for c++/82070, error with nested lambda capture","To":"gcc-patches List <gcc-patches@gcc.gnu.org>","Content-Type":"multipart/mixed; boundary=\"089e08284f889fc17f055889e990\"","X-IsSubscribed":"yes"},"content":"I was expecting that references to capture proxies would be resolved\nin the reconstructed lambda by normal name lookup, but that doesn't\nwork in decltype, and processing the nested lambda really wants to\nfind the new capture proxy, not the captured variable.\n\nTested x86_64-pc-linux-gnu, applying to trunk.\ncommit f9a1fe6d129418e72c68d0d1d9d35089ba7817b2\nAuthor: Jason Merrill <jason@redhat.com>\nDate:   Wed Sep 6 13:41:58 2017 -0400\n\n            PR c++/82070 - error with nested lambda capture\n    \n            * pt.c (tsubst_expr) [DECL_EXPR]: Register capture proxies with\n            register_local_specialization.","diff":"diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c\nindex eb27f6a..4a65e31 100644\n--- a/gcc/cp/pt.c\n+++ b/gcc/cp/pt.c\n@@ -15985,8 +15985,11 @@ tsubst_expr (tree t, tree args, tsubst_flags_t complain, tree in_decl,\n \telse if (is_capture_proxy (decl)\n \t\t && !DECL_TEMPLATE_INSTANTIATION (current_function_decl))\n \t  {\n-\t    /* We're in tsubst_lambda_expr, we've already inserted new capture\n-\t       proxies, and uses will find them with lookup_name.  */\n+\t    /* We're in tsubst_lambda_expr, we've already inserted a new\n+\t       capture proxy, so look it up and register it.  */\n+\t    tree inst = lookup_name (DECL_NAME (decl));\n+\t    gcc_assert (inst != decl && is_capture_proxy (inst));\n+\t    register_local_specialization (inst, decl);\n \t    break;\n \t  }\n \telse if (DECL_IMPLICIT_TYPEDEF_P (decl)\ndiff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-nested7.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-nested7.C\nnew file mode 100644\nindex 0000000..7403315\n--- /dev/null\n+++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-nested7.C\n@@ -0,0 +1,17 @@\n+// PR c++/82070\n+// { dg-do compile { target c++11 } }\n+\n+namespace a {\n+template <typename b>\n+void\n+c (int, int, b d)\n+{\n+  [d] { [d] {}; };\n+}\n+}\n+void\n+e ()\n+{\n+  int f;\n+  a::c (f, 3, [] {});\n+}\n","prefixes":[]}