- Notifications
You must be signed in to change notification settings - Fork 10.6k
Open
Labels
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.triage neededThis issue needs more specific labelsThis issue needs more specific labels
Description
Description
Compiler error if both a class and its subclass have no explicit initializers.
Reproduction
Make a new Xcode project, turn on Swift 6 along with all the trimmings (approachable concurrency, default actor isolation to MainActor).
class Thing {} class SubThing: Thing {}
Compiler: "Main actor-isolated initializer 'init()' has different actor isolation from nonisolated overridden declaration"
Expected behavior
It should just compile. There is no there there, so what's the problem?
Environment
Xcode Version 26.0 (17A324)
% swiftc -version swift-driver version: 1.127.14.1 Apple Swift version 6.2 (swiftlang-6.2.0.19.9 clang-1700.3.19.1) Target: arm64-apple-macosx26.0
Additional information
The fact that there is no init
seems to be the problem. If you add init() {}
to Thing, the error goes away. It is as if a class has an implicit init
which has not gotten the memo about everything being main actor isolated by default.
1mash0, taiju59, TakuyaHida and Harshit7m
Metadata
Metadata
Assignees
Labels
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.triage neededThis issue needs more specific labelsThis issue needs more specific labels