From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id E275E3858D32; Tue, 11 Apr 2023 09:56:00 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E275E3858D32 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1681206960; bh=m35aJaQAZYYuBlUlMHj3j3VsQbqnp5y1n7ME1qJ8Kv8=; h=From:To:Subject:Date:In-Reply-To:References:From; b=GoCRv/kGq+WyOU/vTLULkfHADKDLrBdDqM1yb9J5Xd+RWpDKb+mOsdGwBcZohhOKL kULreko4g4ylNA/DW8QaWcd4L+GElWxwob8iS07h+fxNzPsI44lVNvwvRw7VnExR1x SIaUnppwHVjqQ4BBKDw+KBu9NDeqmAeLdbCgR75E= From: "redi at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/109470] unexpected const & behavior Date: Tue, 11 Apr 2023 09:56:00 +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: unknown X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: redi at gcc dot gnu.org X-Bugzilla-Status: RESOLVED X-Bugzilla-Resolution: INVALID 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: 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=3D109470 --- Comment #5 from Jonathan Wakely --- (In reply to Johannes Kellner from comment #3) > 'A temporary object bound to a reference parameter in a function call > persists until the completion of the full-expression containing the call.' >=20 > So this does not mean, that the temporary object, (int)lenght, should life > until the end of main ??? As main() is the enclosing scope? No, because it says "completion of the full-expression" not "end of the enclosing scope". The full-expression ends at the semi-colon.=