Open
Description
Description
The Swift compiler crashes when emitting SIL for the following Swift code:
// Logger.swift
final class StdoutOutputStream: TextOutputStream {
func write(_ string: String) {}
}
final class DefaultLogger {
private var stdout: TextOutputStream
init(stdout: TextOutputStream = StdoutOutputStream()) {
self.stdout = stdout
}
func logDebug(_ message: String) {
print(message, to: &self.stdout)
}
}
Steps to reproduce
swiftc Logger.swift
Expected behavior
Should compile successfully.
Environment
- Swift compiler version info: swift-driver version: 1.62.15 Apple Swift version 5.7.2 (swiftlang-5.7.2.135.5 clang-1400.0.29.51), Target: arm64-apple-macosx13.0
- Xcode version info: Xcode 14.2, Build version 14C18
- Deployment target: macOS 13.2.1
Metadata
Metadata
Assignees
Labels
Area → compiler: The SIL generation stageA deviation from expected or documented behavior. Also: expected but undesirable behavior.The Swift compiler itselfBug: A crash, i.e., an abnormal termination of softwareFeature: default arguments for value parametersFeature: values of types like `any Collection`, `Any` and `AnyObject`; type-erased valuesFeature → declarations: function parametersFeature: generic declarations and typesFeature → existentials: implicit opening of existentials when passed to parameters of generic typeFeature → types: `inout` typesFeature: typesFeature → declarations → function parameters: Variadic function parameters