Commit 811057f7 authored by Yedidya Feldblum's avatar Yedidya Feldblum Committed by Facebook Github Bot

Fix FixedString taking address of temporary array

Summary:
[Folly] Fix `FixedString` taking address of temporary array with latest versions of GCC.

```
In file included from folly/test/FixedStringTest.cpp:20:
folly/FixedString.h: In instantiation of 'constexpr folly::BasicFixedString<Char, N>& folly::BasicFixedString<Char, N>::erase(std::size_t, std::size_t) [with Char = char; long unsigned int N = 26; std::size_t = long unsigned int]':
folly/test/FixedStringTest.cpp:421:14:   required from here
folly/FixedString.h:1466:11: error: taking address of temporary array
```

Reviewed By: ericniebler

Differential Revision: D13602969

fbshipit-source-id: fefa24eb00021b205498cbc7ebf7c43595d6aa8c
parent 67f61a81
......@@ -1458,11 +1458,12 @@ class BasicFixedString : private detail::fixedstring::FixedStringBase {
std::size_t pos,
std::size_t count = npos) noexcept(false) {
using A = const Char[1];
constexpr A a{Char(0)};
return replace(
pos,
detail::fixedstring::checkOverflowOrNpos(
count, size_ - detail::fixedstring::checkOverflow(pos, size_)),
A{Char(0)},
a,
0u);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment