mirror of
https://gcc.gnu.org/git/gcc.git
synced 2024-12-19 17:15:02 +08:00
libstdc++: Remove bogus assertion in std::from_chars [PR105324]
I'm not sure what I was thinking when I added this assertion, maybe it was supposed to be alignment == 1 (which is what the pmr::string actually uses). The simplest fix is to just remove the assertion. The assertion is no longer enabled by default on trunk, but it's still there for the --enablke-libstdcxx-debug build, and is still wrong. The fix is needed on the gcc-11 branch. libstdc++-v3/ChangeLog: PR libstdc++/105324 * src/c++17/floating_from_chars.cc (buffer_resource::do_allocate): Remove assertion. * testsuite/20_util/from_chars/pr105324.cc: New test.
This commit is contained in:
parent
811c7fbd14
commit
cf37107522
@ -101,7 +101,6 @@ namespace
|
||||
return m_buf + std::__exchange(m_bytes, m_bytes + bytes);
|
||||
|
||||
__glibcxx_assert(m_ptr == nullptr);
|
||||
__glibcxx_assert(alignment != 1);
|
||||
|
||||
m_ptr = operator new(bytes);
|
||||
m_bytes = bytes;
|
||||
|
14
libstdc++-v3/testsuite/20_util/from_chars/pr105324.cc
Normal file
14
libstdc++-v3/testsuite/20_util/from_chars/pr105324.cc
Normal file
@ -0,0 +1,14 @@
|
||||
// { dg-do run { target c++17 } }
|
||||
|
||||
#include <charconv>
|
||||
#include <string>
|
||||
|
||||
int main()
|
||||
{
|
||||
// PR libstdc++/105324
|
||||
// std::from_chars() assertion at floating_from_chars.cc:78
|
||||
std::string s(512, '1');
|
||||
s[1] = '.';
|
||||
long double d;
|
||||
std::from_chars(s.data(), s.data() + s.size(), d);
|
||||
}
|
Loading…
Reference in New Issue
Block a user