[Bug libstdc++/105031] New: wrong constexpr if statement in basic_stacktrace::operator=(basic_stacktrace&&)

hewillk at gmail dot com gcc-bugzilla@gcc.gnu.org
Wed Mar 23 03:02:10 GMT 2022


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

            Bug ID: 105031
           Summary: wrong constexpr if statement in
                    basic_stacktrace::operator=(basic_stacktrace&&)
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hewillk at gmail dot com
  Target Milestone: ---

include/std/stacktrace#L386:

  if constexpr (_AllocTraits::is_always_equal::value)
    std::swap(_M_impl, __other._M_impl);
  else if (_M_alloc == __other._M_alloc)
    std::swap(_M_impl, __other._M_impl);
  else
    {
      const auto __s = __other.size();

      if constexpr (__pocma || _M_impl._M_capacity < __s)
        {
          // Need to allocate new storage.
          _M_clear();

_M_impl._M_capacity cannot be used as a constant expression.

https://godbolt.org/z/zfxd6n5Eb


More information about the Gcc-bugs mailing list