Skip to content

Commit 525cfe3

Browse files
committed
Work around clang miscompile.
Disable optimization on a function which returns a std::optional<bool>. rdar://139105149
1 parent 64e08d7 commit 525cfe3

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/AST/TypeCheckRequests.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -823,7 +823,9 @@ void RequiresOpaqueAccessorsRequest::cacheResult(bool value) const {
823823
// RequiresOpaqueModifyCoroutineRequest computation.
824824
//----------------------------------------------------------------------------//
825825

826-
std::optional<bool>
826+
// NOTE: The [[clang::optnone]] annotation works around a miscompile in clang
827+
// version 13.0.0 affecting at least Ubuntu 20.04, 22.04, and UBI 9.
828+
[[clang::optnone]] std::optional<bool>
827829
RequiresOpaqueModifyCoroutineRequest::getCachedResult() const {
828830
auto *storage = std::get<0>(getStorage());
829831
auto isUnderscored = std::get<1>(getStorage());

0 commit comments

Comments
 (0)