https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107894
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