Created
January 4, 2016 23:52
-
-
Save jqsilver/d363af99656ec34ce9a8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// MyClass.swift | |
// MinimalCrashExample | |
// | |
// Created by Andy Bartholomew on 1/4/16. | |
import Foundation | |
class MyStruct { | |
var someValue: Int | |
init(someValue: Int) { | |
self.someValue = someValue | |
} | |
} | |
protocol SomeProtocol { | |
var someValue: Int { get } | |
func doSomethingWithValue() -> Int | |
} | |
extension SomeProtocol { | |
// This method causes a compiler seg fault | |
func doSomethingWithValue(secretArg: Int? = nil) -> Int { | |
return self.someValue + 1 | |
} | |
} | |
extension MyStruct : SomeProtocol { | |
} | |
func test() { | |
let myStruct = MyStruct(someValue: 5) | |
print(myStruct) | |
print(myStruct.doSomethingWithValue()) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Default arguments in a protocol extension cause the compiler to seg fault in XCode 7.2