Files
swift-mirror/validation-test/compiler_crashers_2_fixed/0009-rdar18996669.swift
Joe Groff d7b9ae72aa Sema: Require '.init' when constructing from a dynamic metatype.
This makes it clearer that expressions like "foo.myType.init()" are creating new objects, instead of invoking a weird-looking method. The last part of rdar://problem/21375845.

Swift SVN r29375
2015-06-14 19:50:06 +00:00

28 lines
401 B
Swift

// RUN: %target-swift-frontend %s -emit-ir -o /dev/null
protocol P {
static var name: String { get }
init(i:Int)
}
class A: P {
class var name: String {
get { return "A" }
}
required init(i:Int) {}
}
class B: P {
class var name: String {
get { return "A" }
}
required init(i:Int) {}
}
let cls:P.Type = A.self
let p:P = cls.init(i:1)
func markUsed<T>(t: T) {}
markUsed(p)