From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id CF0B4385DC2B; Tue, 19 Dec 2023 22:31:59 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CF0B4385DC2B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1703025119; bh=qIhglTKIzdTnrioZCi+gQNax5U1oCX4AajNYXuRVC6s=; h=From:To:Subject:Date:In-Reply-To:References:From; b=SeLwkass0MPkqFZF1/6lO3BT3Hcnawwa9/CyHXb49aqLwSMjklkhIAzC+f7BAdH/m VxSqt8NpLLMVIFobfRyTyGI6c+YP8T12kJo3p9a2qToG3e6Xz8SkRyAVho6e4vlGXw stxwhUGLa/u8xMfPb3vi8bPKJSwDwiWNXyOU3ryU= From: "nathanieloshead at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/113047] dereferencing a null pointer in a constant expression Date: Tue, 19 Dec 2023 22:31:59 +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.2.0 X-Bugzilla-Keywords: accepts-invalid X-Bugzilla-Severity: normal X-Bugzilla-Who: nathanieloshead at gmail dot com 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: cc 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=3D113047 Nathaniel Shead changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |nathanieloshead at gmail d= ot com --- Comment #4 from Nathaniel Shead --- I've pushed a fix for PR102420 (and hence comment #1), but looking at the DR this isn't sufficient for the result of CWG2823, for which presumably all of the following should also start erroring as well (note none of these error = in Clang yet either): struct X { static constexpr int f() { return 0; } }; constexpr int g(X* x) { return (*x).f(); } // error constexpr int a =3D g(nullptr); constexpr int h(X* x) { return x->f(); } // error constexpr int b =3D h(nullptr); // and similarly constexpr int test() { int* p =3D nullptr; *p; // error return 0; } constexpr int t =3D test();=