Segmentation fault 11 with Xcode 11.4 when building for release
sindresorhus opened this issue · comments
Seems there's a compiler crash in the latest Swift 5.2 compiler.
I haven't yet tracked down exactly what the issue is, but it can be reproduced with simple code like:
import SwiftUI
import Grid
struct Foo: Hashable {}
struct GifsView: View {
var body: some View {
List([Foo()], id: \.self) { _ in
Text("")
}
.gridStyle(ModularGridStyle(columns: 1, rows: 1))
}
}
So it's definitely something in .gridStyle
or GridStyle
.
You can also reproduce the crash by opening the Xcode project in this repo, selecting the "GridDemo macOS" target and and then selecting the "Product => Archive" menu item.
I would recommend getting this project added to https://github.com/apple/swift-source-compat-suite
Same, I thought it was just me. thank goodness
@sindresorhus @imjameshall turns out with this new version of Swift and Xcode this function
func gridStyle<S>(_ style: S) -> some View where S : GridStyle
has to be inlinable
@inlinable func gridStyle<S>(_ style: S) -> some View where S : GridStyle
@ay42 Do you agree it's a Swift compiler bug? If so, I can open an issue on the Swift bug tracker.
@sindresorhus looks like it.
I just checked in other repos and it only happens when both are true:
- It's in a dependency (if you move this function to your project it works)
- Argument is a protocol (if it's a struct it's fine)