From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 8D3113858CDB; Mon, 28 Nov 2022 10:27:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8D3113858CDB DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1669631271; bh=nCmUomFZW0OX/c2R45he97BZaHG3yV/+Rv+LKonqwLU=; h=From:To:Subject:Date:From; b=wYzUIcVhVFrMWq6cUwCkLCSn149yFX1mKXbixpNlY1YihLEl2v4LI+G2xLO4iGCeR 1c7H+yq//Jy3P9zfgLYYCSYLydxxBrItqttzl8xQ/uMji99PGGR8HoYtobolyvx7zU kpSh4yVA9SXjNcYsglfOz+j9D6LH9Mb0sYXydHMo= From: "tim at klingt dot org" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/107894] New: [feature request] _GLIBCXX_ASSERTIONS for std::optional Date: Mon, 28 Nov 2022 10:27:51 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libstdc++ X-Bugzilla-Version: 12.1.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: tim at klingt dot 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 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D107894 Bug ID: 107894 Summary: [feature request] _GLIBCXX_ASSERTIONS for std::optional Product: gcc Version: 12.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: tim at klingt dot org Target Milestone: --- `_GLIBCXX_ASSERTIONS` does not enable any API validation for std::optional. e.g. `operator->` translates to `address_to`: https://github.com/gcc-mirror/gcc/blob/master/libstdc%2B%2B-v3/include/std/= optional#L969-L970 libc++ on the other hand has assertions that can detect invalid uses: https://github.com/llvm/llvm-project/blob/main/libcxx/include/optional#L930= -L937 it would be great if libstdc++ could perform the same validation=