Message ID | 20220421103501.1530890-1-jwakely@redhat.com |
---|---|
State | New |
Headers | show |
Series | [committed] libstdc++: Remove bogus assertion in std::from_chars [PR105324] | expand |
diff --git a/libstdc++-v3/src/c++17/floating_from_chars.cc b/libstdc++-v3/src/c++17/floating_from_chars.cc index bbe03f7f068..0f5183aa9b5 100644 --- a/libstdc++-v3/src/c++17/floating_from_chars.cc +++ b/libstdc++-v3/src/c++17/floating_from_chars.cc @@ -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; diff --git a/libstdc++-v3/testsuite/20_util/from_chars/pr105324.cc b/libstdc++-v3/testsuite/20_util/from_chars/pr105324.cc new file mode 100644 index 00000000000..cecb17e41cc --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/from_chars/pr105324.cc @@ -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); +}