From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 0B6F23870867; Tue, 21 Apr 2020 20:14:29 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0B6F23870867 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1587500069; bh=oXntj8FRCupRwYalH/E92APdVEvnsYuZlRoBf1wPieA=; h=From:To:Subject:Date:From; b=U0gLuPjWpQgMVY54dWG+5Te+IdcaIC26kWso24374r9arH81z5vuLnFNKdE30ZBaF /+SR4LNMxEOU/4bGk1gqeQ5XydOt/CV4pWSnWU3Zw8/q9DX/a3NrcQttF/sB7oNeDV rK+3EhzgaO1pme0fTMGJEkUFpsc3z9tGeRxjdZuY= From: "iains at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/94701] New: coroutines: Wrong code for structured bindings. Date: Tue, 21 Apr 2020 20:14:28 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 10.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: iains at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone attachments.created Message-ID: 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 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Apr 2020 20:14:29 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D94701 Bug ID: 94701 Summary: coroutines: Wrong code for structured bindings. Product: gcc Version: 10.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: iains at gcc dot gnu.org Target Milestone: --- Created attachment 48330 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=3D48330&action=3Dedit patch under test As reported by Micha=C5=82 Dominiak, the following code gets an incorrect a= nswer - this is because we fail to check for DECL_VALUE_EXPR in the handling for lo= cal vars. struct promise; struct future { using promise_type =3D promise; }; struct promise { template promise (Args&... args) {} coro::suspend_never initial_suspend() { return {}; } coro::suspend_never final_suspend() { return {}; } future get_return_object() { return {}; } void return_value(int) {} void unhandled_exception() {} }; #include struct pair { int i; }; pair=20 something () { return { 1 }; } future=20 my_coro () {=20=20=20 auto ret =3D something (); assert(ret.i =3D=3D 1); auto [ i ] =3D something (); assert(i =3D=3D 1); co_return 1; } int main () { my_coro (); }=