{"id":2174159,"url":"http://patchwork.ozlabs.org/api/patches/2174159/?format=json","web_url":"http://patchwork.ozlabs.org/project/gcc/patch/CAD+gk=jyb+y=59CD-T1-SrbXt2y-SgT3fZECyyefwyrGYiLkSQ@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":"<CAD+gk=jyb+y=59CD-T1-SrbXt2y-SgT3fZECyyefwyrGYiLkSQ@mail.gmail.com>","list_archive_url":null,"date":"2025-12-15T08:24:35","name":"c++: initialize constructor_possible_p with LOCAL_CLASS_P","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"e74d3f4ed0dc162857112a3b5287c276ea38e74e","submitter":{"id":91423,"url":"http://patchwork.ozlabs.org/api/people/91423/?format=json","name":"Ben Wu","email":"soggysocks206@gmail.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/gcc/patch/CAD+gk=jyb+y=59CD-T1-SrbXt2y-SgT3fZECyyefwyrGYiLkSQ@mail.gmail.com/mbox/","series":[{"id":485362,"url":"http://patchwork.ozlabs.org/api/series/485362/?format=json","web_url":"http://patchwork.ozlabs.org/project/gcc/list/?series=485362","date":"2025-12-15T08:24:35","name":"c++: initialize constructor_possible_p with LOCAL_CLASS_P","version":1,"mbox":"http://patchwork.ozlabs.org/series/485362/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2174159/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2174159/checks/","tags":{},"related":[],"headers":{"Return-Path":"<gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org>","X-Original-To":["incoming@patchwork.ozlabs.org","gcc-patches@gcc.gnu.org"],"Delivered-To":["patchwork-incoming@legolas.ozlabs.org","gcc-patches@gcc.gnu.org"],"Authentication-Results":["legolas.ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256\n header.s=20230601 header.b=e9yQtaco;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org\n (client-ip=38.145.34.32; helo=vm01.sourceware.org;\n envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org;\n receiver=patchwork.ozlabs.org)","sourceware.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key,\n unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256\n header.s=20230601 header.b=e9yQtaco","sourceware.org;\n dmarc=pass (p=none dis=none) header.from=gmail.com","sourceware.org; spf=pass smtp.mailfrom=gmail.com","server2.sourceware.org;\n arc=none smtp.remote-ip=209.85.217.43"],"Received":["from vm01.sourceware.org (vm01.sourceware.org [38.145.34.32])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4dVCmc3WxGz1xyL\n\tfor <incoming@patchwork.ozlabs.org>; Mon, 15 Dec 2025 19:25:20 +1100 (AEDT)","from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id 771BB4BA2E07\n\tfor <incoming@patchwork.ozlabs.org>; Mon, 15 Dec 2025 08:25:18 +0000 (GMT)","from mail-vs1-f43.google.com (mail-vs1-f43.google.com\n [209.85.217.43])\n by sourceware.org (Postfix) with ESMTPS id 9C0054BA2E04\n for <gcc-patches@gcc.gnu.org>; Mon, 15 Dec 2025 08:24:48 +0000 (GMT)","by mail-vs1-f43.google.com with SMTP id\n ada2fe7eead31-5dfa9e34adbso2213533137.0\n for <gcc-patches@gcc.gnu.org>; Mon, 15 Dec 2025 00:24:48 -0800 (PST)"],"DKIM-Filter":["OpenDKIM Filter v2.11.0 sourceware.org 771BB4BA2E07","OpenDKIM Filter v2.11.0 sourceware.org 9C0054BA2E04"],"DMARC-Filter":"OpenDMARC Filter v1.4.2 sourceware.org 9C0054BA2E04","ARC-Filter":"OpenARC Filter v1.0.0 sourceware.org 9C0054BA2E04","ARC-Seal":"i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1765787088; cv=none;\n b=B7Rc4S/cGPWWKpULVaidJuy+3vBV2QHFUM4qdFShdqyL3rLKa/dGH/Fy+dQvZaenhbp73Tvqv3oVRvTOj1LC9vJs3P4KWz5Tv6YGSB4hQsV6aD/k2Hkekt+eRaDbw6aVjmHxGZJ3e6WgLtAx89RzKyEfp9twO9i0LSomWe+YQHg=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=sourceware.org; s=key;\n t=1765787088; c=relaxed/simple;\n bh=OJsOxxRxGf/WPtGnbfUX1DvaEDMRP57CFscqgtWVgEc=;\n h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To;\n b=odAEhq+D/WV2kM0ucsaS2XkuqIZt7xYawJM2N1EGYHOdzHEsj+zcpIi7ebO64PJ4WorKjrMAYftKLAmxtOeuTjsNx/x8ujWBzPoB+SwkKUCYvNYTigMQgK/4ojYQC3NQl/dq0dag7CmUGR7XUdrruIXItQuhLJTlGltadz2s068=","ARC-Authentication-Results":"i=1; server2.sourceware.org","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=gmail.com; s=20230601; t=1765787088; x=1766391888; darn=gcc.gnu.org;\n h=cc:to:subject:message-id:date:from:mime-version:from:to:cc:subject\n :date:message-id:reply-to;\n bh=CJXXvfaeTw3tmw+zLKAkSQCZEIzBn2C70byBZrB3y88=;\n b=e9yQtacoWnI5ei/hWPVWIibCByXk+9GVBLu4l+x2b3L1JIe2VQ5hXc+5PSvdpyXTG5\n XIE7mOGhnNW5Hz5UN9SkSL19Ju3US3RcohOed2M1I20PPv7SjcUGCO8VtinwrfwFpV7F\n WFHmiXFAWnWhJpGR3VHMBd1FLjUVNxlcCrC2bGQmXeWv46mS9O7j3/A+XFi3KdO8Hwai\n FSOYZl2PyCDmjWP7PLMTMQ9MNRJz2e4QMmvDtwbyUyB4Bu+ogLRe/s6Z/Jt+K6xWz05z\n jMMb5jq+XuPIK2gST7yQHTlprlIainQ8FSMkTjuiVg0HsDgEKFDpTp8GVNNg8rgbux5c\n CKfQ==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20230601; t=1765787088; x=1766391888;\n h=cc:to:subject:message-id:date:from:mime-version:x-gm-gg\n :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;\n bh=CJXXvfaeTw3tmw+zLKAkSQCZEIzBn2C70byBZrB3y88=;\n b=lgwQE8HKAIV+qnACWEg6/vawltU2SA5dsKuslODsD21ixvhlIw0TooKCt9cn2o/dLV\n XZAfIOzzkNXTf2czLtOOu7FrBDV6VTqsUKWH6JJ2JmZnEVdAYqSZ5P+SFIuOnZrsMEgb\n RXIutFo1nk4giVZRIiFNrYhQz3KJyOm4yov8RjJBR6l7nRHozX7tGnjDKS/xldnW5aTb\n fuaj/ye17Kj2V75+VRUTSwtCotJ1P+O0a56eG23lNd9XhjmNXeQom68FQz60xUVze2pS\n T1FWD37p5xV6vdJxquUoBbHxdNPQslPKofGWybLK8dfVjpDVTEvI7tJs8D6vKkQiC3he\n Mwnw==","X-Gm-Message-State":"AOJu0YwJ/GD62oB/viU6P3pQp1IY1BTLwJ3pdJxI+10GQc6MAAczUKfy\n OiGYgHqLuf2GJcKHGmtaQrTRBpNp7fZt4I9S3spaPjPzAmAJp3cuj6ArTU7tmKR1VndAJ8YVlX7\n bdyHK7imwX5iXZXtSYhoHzvZiFpYamOnBj8/e","X-Gm-Gg":"AY/fxX6JGCnQazvuqHVfhLMK5+DzVDTFVwKNKDBzgz354lHrEUa5NKIdYsQirBpuvtF\n rJwoQTaiz8RGmr9gV53IJwVoe4rtqbV+Ljn/sqp2xb1cjKX74shm2jLs0Lhx9+A6cOGxP7L0z8n\n u0W4AKmccOD9Ah9MZqPu7YdslI2rC9aWkmqNDYekKcMWshSIib0xp9UsllQmLIeA/BBy3n/2A7N\n dZ0tcNhtY5VKblkqF656l9gmYrOCRTnR0xjL5+/N4GtE6frry9smTTXTGJCnepPHyb9iW7BvlxK\n AYFHukI6P27/67xT//Sd0pRBGnQ7UuffhJPtkj+yoNBbrWYzbM64P6EOvGa7RrAcrgDVQvakNMR\n L88rfGE7Y","X-Google-Smtp-Source":"\n AGHT+IHWBdW9NYFPbwtJhiFQSsQuWkBmf6tG4f1Zh41CG5mZV++JrJZ9cCsvir2Jw5tDMCUxCp0HLe0/HAcOZLduXCc=","X-Received":"by 2002:a05:6102:5a96:b0:5db:d07c:21a9 with SMTP id\n ada2fe7eead31-5e8277e7dfamr3542287137.35.1765787087873; Mon, 15 Dec 2025\n 00:24:47 -0800 (PST)","MIME-Version":"1.0","From":"Ben Wu <soggysocks206@gmail.com>","Date":"Mon, 15 Dec 2025 00:24:35 -0800","X-Gm-Features":"AQt7F2oPsg8Ytk6OIrKeYUZo3qNM2NpcXL-MHogVvlStmTObGTDrg89g7Fpt5GI","Message-ID":"\n <CAD+gk=jyb+y=59CD-T1-SrbXt2y-SgT3fZECyyefwyrGYiLkSQ@mail.gmail.com>","Subject":"[PATCH] c++: initialize constructor_possible_p with LOCAL_CLASS_P","To":"gcc-patches@gcc.gnu.org","Cc":"Jason Merrill <jason@redhat.com>","Content-Type":"multipart/mixed; boundary=\"0000000000001f3d3c0645f95876\"","X-BeenThere":"gcc-patches@gcc.gnu.org","X-Mailman-Version":"2.1.30","Precedence":"list","List-Id":"Gcc-patches mailing list <gcc-patches.gcc.gnu.org>","List-Unsubscribe":"<https://gcc.gnu.org/mailman/options/gcc-patches>,\n <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe>","List-Archive":"<https://gcc.gnu.org/pipermail/gcc-patches/>","List-Post":"<mailto:gcc-patches@gcc.gnu.org>","List-Help":"<mailto:gcc-patches-request@gcc.gnu.org?subject=help>","List-Subscribe":"<https://gcc.gnu.org/mailman/listinfo/gcc-patches>,\n <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe>","Errors-To":"gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org"},"content":"Bootstrapped and regtested on x86_64-pc-linux-gnu. Any thoughts on this\napproach?\n\nPlease use the attached patch file if applying, thanks!\n\n-- 8< --\n\nPreviously, constructors were not possibly parsed while in a\ndeclarator, but we may have a constructor in a declarator as in this\nPR where a lambda expression containing a class definition is a\ndefault argument.\n\nWe can account for this by checking current_class_type when\ninitializing constructor_possible_p so that we allow for a constructor\ninside a declarator if LOCAL_CLASS_P (current_class_type).\n\nPR c++/121443\n\ngcc/cp/ChangeLog:\n\n* parser.cc (cp_parser_decl_specifier_seq): Consider LOCAL_CLASS_P\nin initializing constructor_possible_p.\n\ngcc/testsuite/ChangeLog:\n\n* g++.dg/parse/pr121443.C: New test.\n---\n gcc/cp/parser.cc                      |  4 +++-\n gcc/testsuite/g++.dg/parse/pr121443.C | 10 ++++++++++\n 2 files changed, 13 insertions(+), 1 deletion(-)\n create mode 100644 gcc/testsuite/g++.dg/parse/pr121443.C","diff":"From ea625e2ad0ca4826b84449e26602b840e7cf355b Mon Sep 17 00:00:00 2001\nFrom: benwu25 <soggysocks206@gmail.com>\nDate: Mon, 15 Dec 2025 00:14:25 -0800\nSubject: [PATCH] c++: initialize constructor_possible_p with LOCAL_CLASS_P\n\nPreviously, constructors were not possibly parsed while in a\ndeclarator, but we may have a constructor in a declarator as in this\nPR where a lambda expression containing a class definition is a\ndefault argument.\n\nWe can account for this by checking current_class_type when\ninitializing constructor_possible_p so that we allow for a constructor\ninside a declarator if LOCAL_CLASS_P (current_class_type).\n\n\tPR c++/121443\n\ngcc/cp/ChangeLog:\n\n\t* parser.cc (cp_parser_decl_specifier_seq): Consider LOCAL_CLASS_P\n\tin initializing constructor_possible_p.\n\ngcc/testsuite/ChangeLog:\n\n\t* g++.dg/parse/pr121443.C: New test.\n---\n gcc/cp/parser.cc                      |  4 +++-\n gcc/testsuite/g++.dg/parse/pr121443.C | 10 ++++++++++\n 2 files changed, 13 insertions(+), 1 deletion(-)\n create mode 100644 gcc/testsuite/g++.dg/parse/pr121443.C\n\ndiff --git a/gcc/cp/parser.cc b/gcc/cp/parser.cc\nindex 214dababeb5..7683c160b14 100644\n--- a/gcc/cp/parser.cc\n+++ b/gcc/cp/parser.cc\n@@ -17700,7 +17700,9 @@ cp_parser_decl_specifier_seq (cp_parser* parser,\n \t\t\t      cp_decl_specifier_seq *decl_specs,\n \t\t\t      int* declares_class_or_enum)\n {\n-  bool constructor_possible_p = !parser->in_declarator_p;\n+  const bool maybe_lambda_p = (current_class_type\n+\t\t\t       && LOCAL_CLASS_P (current_class_type));\n+  bool constructor_possible_p = !parser->in_declarator_p || maybe_lambda_p;\n   bool found_decl_spec = false;\n   cp_token *start_token = NULL;\n   cp_decl_spec ds;\ndiff --git a/gcc/testsuite/g++.dg/parse/pr121443.C b/gcc/testsuite/g++.dg/parse/pr121443.C\nnew file mode 100644\nindex 00000000000..1022b3cdd90\n--- /dev/null\n+++ b/gcc/testsuite/g++.dg/parse/pr121443.C\n@@ -0,0 +1,10 @@\n+// { dg-do compile { target c++11 } }\n+\n+void f(int i = []() {\n+  struct X {\n+    int val;\n+    X(int v) : val(v) { }\n+  };\n+  X x(2);\n+  return x.val;\n+}()) {}\n-- \n2.43.0\n\n","prefixes":[]}