https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110542

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #55475|0                           |1
        is obsolete|                            |

--- Comment #7 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Created attachment 55477
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55477&action=edit
Reduced test case

Slightly further reduced, so it compiles successfully with clang.

GCC gives:

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:1014: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:177:24:   in
'constexpr' expansion of 'std::vector<int>::_S_relocate(__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_vector.h:497:35:   in
'constexpr' expansion of 'std::__relocate_a<int*, int*, allocator<int>
>(__first, __last, __result, (* & __alloc))'
/home/jwakely/gcc/14/include/c++/14.0.0/bits/stl_uninitialized.h:1134:33:   in
'constexpr' expansion of 'std::__relocate_a_1<int,
int>(std::__niter_base<int*>(__first), std::__niter_base<int*>(__last),
std::__niter_base<int*>(__result), (* & __alloc))'
/home/jwakely/gcc/14/include/c++/14.0.0/bits/stl_uninitialized.h:1114:37:   in
'constexpr' expansion of 'std::__relocate_object_a<int, int, allocator<int>
>(std::__addressof<int>((* __cur)), std::__addressof<int>((* __first)), (* &
__alloc))'
/home/jwakely/gcc/14/include/c++/14.0.0/bits/stl_uninitialized.h:1065:26:   in
'constexpr' expansion of 'std::allocator_traits<std::allocator<int>
>::construct<int, int>((* & __alloc), __dest, (* &
std::move<int&>((*(int*)__orig))))'
/home/jwakely/gcc/14/include/c++/14.0.0/bits/alloc_traits.h:539:21:   in
'constexpr' expansion of 'std::construct_at<int, int>(__p, (* &
std::forward<int>((* & __args#0))))'
110542.cc:23:25: error: use of allocated storage after deallocation in a
constant expression
/home/jwakely/gcc/14/include/c++/14.0.0/bits/allocator.h:195:52: note:
allocated here
  195 |             return static_cast<_Tp*>(::operator new(__n));
      |                                      ~~~~~~~~~~~~~~^~~~~

Reply via email to