https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125450
Bug ID: 125450
Summary: std::optional breaks in C++26 freestanding mode
Product: gcc
Version: 16.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libstdc++
Assignee: unassigned at gcc dot gnu.org
Reporter: debashish47 at gmail dot com
Target Milestone: ---
Compilation fails when using std::optional in C++26 freestanding mode (since
GCC 16 onwards)
Code:
--------------------------------------------------------------
// -std=c++26 -fno-exceptions -fno-rtti -ffreestanding -nostdlib
#include <optional>
static_assert(!std::optional<int>{}.has_value());
--------------------------------------------------------------
Reference: https://godbolt.org/z/WGE9eefYT