mirror of
https://github.com/zebrajr/tensorflow.git
synced 2025-12-06 12:20:11 +01:00
Work around compiler bug returning an optional unique_ptr.
It looks like some compilers (e.g. gcc-7) don't like returning a moveable value directly when the return type is `std::optional` (i.e. it fails to treat the returned value as an r-value and automatically construct an optional instance around it). Explicitly creating the `std::optional` and returning _that_ seems to work around the issue. PiperOrigin-RevId: 507062621
This commit is contained in:
parent
7a39261f92
commit
f024cd92f6
|
|
@ -455,7 +455,8 @@ class FftPlanCache {
|
|||
cache_.erase(it);
|
||||
}
|
||||
--size_;
|
||||
return value;
|
||||
// Explicitly create an optional to avoid a compiler bug with gcc-7.
|
||||
return std::optional<Value>(std::move(value));
|
||||
}
|
||||
|
||||
// Inserts a plan into the cache as long as there is still capacity.
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user