From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id EAAB83858439; Fri, 18 Nov 2022 00:49:28 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org EAAB83858439 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1668732568; bh=7E7RTcBixw9Cf5Vqdq/lg1lU20NSCQvKft33MNYUjIM=; h=From:To:Subject:Date:In-Reply-To:References:From; b=EoYV4bUoGYBsSxvsCMdCvh4SKzNgvsokISXYPI11HKiOVGkcp8gGVo1UJITSpWBlk AFNuYwbH8+kzdDtlYU9AEeLFOe8w9BPec3YuZnS0eSbobrNviB9Pkb/uCkUY6J2alt lTQhkjGr7TsU1BbtBntBvfWFw32MGJ3XdEuPPefs= From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/107735] Inconsistent error messages for std::array out of bound due to taking the address of one-past-the-end is valid Date: Fri, 18 Nov 2022 00:49:28 +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: 12.1.0 X-Bugzilla-Keywords: diagnostic X-Bugzilla-Severity: normal X-Bugzilla-Who: pinskia at gcc dot gnu.org X-Bugzilla-Status: NEW 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: 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=3D107735 --- Comment #4 from Andrew Pinski --- (In reply to Jonathan Wakely from comment #3) > (In reply to Andrew Pinski from comment #2) > > I wonder if this is because doing=20 > > constexpr const int *v1 =3D &array[3]; > >=20 > > is valid and well defined. >=20 > It's not, but &array.data()[3] is. >=20 > I agree that's probably the reason for the different diagnostics. Interesting because both GCC and clang accept "constexpr const int *v1 =3D &array[3];" though.=