<div class="chatlog__message-group"> <div id="chatlog__message-container-1170922889684467763" class="chatlog__message-container" data-message-id="1170922889684467763"> <div class="chatlog__message"> <div class="chatlog__message-aside"><img class="chatlog__avatar" src="https://cdn.discordapp.com/avatars/310258733890535426/8fffd5befbc057dcd546b39b0259e66a.png?size=512" alt="Avatar" loading="lazy"></div> <div class="chatlog__message-primary"> <div class="chatlog__header"><span class="chatlog__author" title="iceman5499" data-user-id="310258733890535426">Iceman</span> <a href="/channels/375206337937801216?category=main&channel=swift-zatsu&message_id=1170922889684467763"><span class="chatlog__timestamp" title="Monday, November 6, 2023 3:09 AM"></span></a><a href="#chatlog__message-container-1170922889684467763">11/6/2023 3:09 AM</a></div> <div class="chatlog__content chatlog__markdown"><span class="chatlog__markdown-preserve"><span class="chatlog__markdown-mention" title="swift59#5142">@swift-5.9.2</span> -strict-concurrency=complete <code class="chatlog__markdown-pre chatlog__markdown-pre--multiline language-swift">import Foundation func takeSendableClosure(_ c: @Sendable @escaping () -> ()) { Task.detached(operation: c) } let nonSendable: () -> () = {} takeSendableClosure(nonSendable) // 警告出る struct S { var nonSendableValue: () -> () @Sendable func mayUseNonSendableValue() { nonSendableValue() } } var count = 0 var s = S(nonSendableValue: { count += 1 }) takeSendableClosure(s.mayUseNonSendableValue) // 警告出ない for _ in 0..<10000 { takeSendableClosure(s.mayUseNonSendableValue) } print(count) sleep(1) print(count)</code></span> <span class="chatlog__edited-timestamp" title="Monday, November 6, 2023 3:12 AM">(edited)</span></div> </div> </div> </div> </div>