From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id ABEAF3831E1C; Mon, 5 Jun 2023 14:08:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org ABEAF3831E1C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1685974093; bh=nlunKyBZ6E4psxdeccxOJFXAhFE1+lCS9S1Ogf59uMc=; h=From:To:Subject:Date:In-Reply-To:References:From; b=xpIa2XWFMgT3qzd3I+e60mvokSDDM1sgcvIwaL31FZk800m4LZOCMpvo1eyPPiVyB og5vCxDpDwiLb9H6Ff4Ce/NjZTreA2QCk+SnGtblPYPoxrcSbDyPi25m0ygLA2Hxbl XlEegKA0AMIXPz1YuY/jZcuOajq908XO8CF3TyF4= From: "ppalka at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/110122] [13/14 Regression] using an aggregate with a member variable with a user defined copy constructor in a class NTTP causes capture and use of the `this` pointer in a generic lambda to produce the following error "-copy ctor- used before its definition" Date: Mon, 05 Jun 2023 14:08:12 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 13.1.0 X-Bugzilla-Keywords: rejects-valid X-Bugzilla-Severity: normal X-Bugzilla-Who: ppalka at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: ppalka at gcc dot gnu.org X-Bugzilla-Target-Milestone: 13.2 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cf_reconfirmed_on cf_known_to_work cc keywords cf_known_to_fail everconfirmed short_desc target_milestone assigned_to see_also bug_status Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D110122 Patrick Palka changed: What |Removed |Added ---------------------------------------------------------------------------- Last reconfirmed| |2023-06-05 Known to work| |12.3.0 CC| |ppalka at gcc dot gnu.org Keywords| |rejects-valid Known to fail| |13.1.0, 14.0 Ever confirmed|0 |1 Summary|using an aggregate with a |[13/14 Regression] using an |member variable with a user |aggregate with a member |defined copy constructor in |variable with a user |a class NTTP causes capture |defined copy constructor in |and use of the `this` |a class NTTP causes capture |pointer in a generic lambda |and use of the `this` |to produce the following |pointer in a generic lambda |error "-copy constructor- |to produce the following |used before its definition" |error "-copy ctor- used | |before its definition" Target Milestone|--- |13.2 Assignee|unassigned at gcc dot gnu.org |ppalka at gcc dot g= nu.org See Also| |https://gcc.gnu.org/bugzill | |a/show_bug.cgi?id=3D104577 Status|UNCONFIRMED |ASSIGNED --- Comment #1 from Patrick Palka --- Confirmed, thanks very much for the detailed analysis and reproducer. Star= ted with r13-1045-gcb7fd1ea85feea. Here's another version of the testcase (with a commented out workaround) th= at uses a non-capturing generic lambda and a non-member function: struct Foo { constexpr Foo() =3D default; constexpr Foo(Foo const&) {} }; struct Bar { Foo _; // Workaround: force Bar's copy ctor to be synthesized early // static Bar force_synthesize_copy_ctor(Bar& b) { return b; }; }; template struct Doppelganger { }; template void disguise() { [](auto){ Doppelganger d; }(0); }; void execute() { disguise(); }=