https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95806
Bug ID: 95806 Summary: Result of call with reference argument to newed object is cached during constant evaluation Product: gcc Version: 10.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: johelegp at gmail dot com Target Milestone: --- See https://godbolt.org/z/zzM-Qn. ```C++ #include <cassert> constexpr bool is_zero(int& x) { return x == 0; } constexpr void f() { int& x = *new int{0}; assert(is_zero(x)); x = 1; assert(!is_zero(x)); delete &x; } constexpr int x{([]() consteval { f(); }(), 0)}; ```