https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117504
Patrick Palka <ppalka at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |ice-on-valid-code Known to work| |7.5.0 Target Milestone|--- |12.5 Status|UNCONFIRMED |NEW Ever confirmed|0 |1 Summary|Incorrect code emitted when |[12/13/14/15 Regression] |using "constexpr |Incorrect code emitted when |std::array" |using "constexpr | |std::array" CC| |ppalka at gcc dot gnu.org Last reconfirmed| |2024-11-12 --- Comment #1 from Patrick Palka <ppalka at gcc dot gnu.org> --- Reduced: struct span { #if 1 span(const int (&__first)[1]) : _M_ptr(__first) {} #else span(const int* __first) : _M_ptr(__first) {} #endif int operator[](long __i) { return _M_ptr[__i]; } const int *_M_ptr; }; int main() { constexpr int a_vec[]{1}; auto vec{[&a_vec]() -> span { return a_vec; }()}; if (vec[0] != 1) __builtin_abort(); } Started with r8-3497-g281e6c1d8f1b4c. If we toggle the #if then we instead ICE from build_address.