Page MenuHome

Fix std::optional value() build error on older macOS SDK
ClosedPublic

Authored by dupoxy (dupoxy) on May 7 2022, 8:43 AM.

Details

Summary

Fix std::optional value() build error on older macOS SDK

No longer happens on the buildbot, but for users building with an older
Xcode , still need to avoid using value().

To see the build failure: https://devtalk.blender.org/t/build-failing-on-macosx-error-value-is-unavailable-introduced-in-macos-10-14

Diff Detail

Repository
rB Blender

Event Timeline

dupoxy (dupoxy) requested review of this revision.May 7 2022, 8:43 AM
dupoxy (dupoxy) created this revision.

@dupoxy (dupoxy) Looks OK to me! Although I'm quite surprised that compiler isn't bother with .value_or("") on line 103, while it has problems with "vanila" .value() call. Oh well...
Sorry for the trouble!

This revision is now accepted and ready to land.May 7 2022, 10:08 AM
dupoxy (dupoxy) edited the summary of this revision. (Show Details)May 7 2022, 1:00 PM

@Piotr Makal (pmakal) no trouble .
Thanks for the quick look.

Just FYI
https://en.cppreference.com/w/cpp/utility/optional/operator*

This operator does not check whether the optional contains a value! You can do so manually by using has_value() or simply operator bool(). Alternatively, if checked access is needed, value() or value_or() may be used.

The change in itself looks ok to me. I can't review it though, don't have a mac.