https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110542
Jonathan Wakely <redi at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #55477|0 |1 is obsolete| | --- Comment #8 from Jonathan Wakely <redi at gcc dot gnu.org> --- Created attachment 55483 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55483&action=edit Further reduced test case This compiles with both Clang and EDG, but not GCC: $ g++ -std=c++20 a-110542.ii In file included from /home/jwakely/gcc/14/include/c++/14.0.0/bits/vector.tcc:89, from /home/jwakely/gcc/14/include/c++/14.0.0/vector:69, from 110542.cc:2: 110542.cc: In function 'int main()': 110542.cc:23:25: error: non-constant condition for static assertion 23 | static_assert(test1() == 1); | ~~~~~~~~^~~~ 110542.cc:23:22: in 'constexpr' expansion of 'test1()' 110542.cc:18:7: in 'constexpr' expansion of 's.s_t::rz(2)' 110542.cc:11:49: in 'constexpr' expansion of '(& w)->std::vector<int>::resize(n)' /home/jwakely/gcc/14/include/c++/14.0.0/bits/stl_vector.h:268:28: in 'constexpr' expansion of '((std::vector<int>*)this)->std::vector<int>::_M_default_append((__new_size - ((std::vector<int>*)this)->std::vector<int>::size()))' /home/jwakely/gcc/14/include/c++/14.0.0/bits/vector.tcc:73:28: in 'constexpr' expansion of 'std::__relocate_a<int, int>(__old_start, __old_finish, __new_start, (* &((std::vector<int>*)this)->std::vector<int>::<anonymous>.std::_Vector_base<int, std::allocator<int> >::_M_get_Tp_allocator()))' /home/jwakely/gcc/14/include/c++/14.0.0/bits/stl_uninitialized.h:30:26: in 'constexpr' expansion of 'std::construct_at<int, int>(__result, (* & std::move<int&>((* __first))))' 110542.cc:23:25: error: use of allocated storage after deallocation in a constant expression In file included from /home/jwakely/gcc/14/include/c++/14.0.0/vector:63: /home/jwakely/gcc/14/include/c++/14.0.0/bits/allocator.h:195:55: note: allocated here 195 | return static_cast<_Tp*>(::operator new(__n)); | ~~~~~~~~~~~~~~^~~~