Skip to content

(Linux) Build failure against 2024-09-25 nightly toolchain -- error: cannot inherit from class 'Thread' (compiled with Swift 6.1) because it has overridable members that could not be loaded in Swift 5.10 #615

Open
@clackary

Description

@clackary

This one is another instance of a swiftlang compiler bug I've been running into for a while: swiftlang/swift-corelibs-foundation#5108

root@7481e59c0960:/project/opentelemetry-swift# /home/dev-toolchain/swift-DEVELOPMENT-SNAPSHOT-2024-09-25-a-ubuntu22.04-aarch64/usr/bin/swift build
...
/project/opentelemetry-swift/Sources/OpenTelemetrySdk/Logs/Processors/BatchLogRecordProcessor.swift:41:15: error: cannot inherit from class 'Thread' (compiled with Swift 6.1) because it has overridable members that could not be loaded in Swift 5.10
 39 | }
 40 | 
 41 | private class BatchWorker : Thread {
    |               `- error: cannot inherit from class 'Thread' (compiled with Swift 6.1) because it has overridable members that could not be loaded in Swift 5.10
 42 |   let logRecordExporter : LogRecordExporter
 43 |   let scheduleDelay : TimeInterval

From what I've seen in the other cases, it looks like would be feasible to workaround the issue by making a Thread property within BatchWorker, and then wrapping the start and cancel calls with matching BatchWorker funcs.

But the problem here is the override on Thread.main(). I don't think there's a way to do this without inheriting from Thread.

Configuration:
OS: Linux Ubuntu 22.04
Toolchain: swift-DEVELOPMENT-SNAPSHOT-2024-09-25-a-ubuntu22.04-aarch64

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions