Skip to content

Certain deinit's on ~Copyable types fail to compile #68328

@rvsrvs

Description

@rvsrvs

Description

The following code fails to compile using Xcode 15b8:

struct Example: ~Copyable {
    private var failureString: String { "Goodbye." }
    deinit { fatalError("FATAL ERROR: \(failureString)") }
}

It produces the error:

Usage of a noncopyable type that compiler can't verify. This is a compiler bug. Please file a bug with a small example of the bug

Steps to reproduce

Cut and paste the above struct into a playground and observe the compiler error

Expected behavior

It should compile and, when run, the deinit should cause a fatal error to occur with the correct error message.

Environment

  • Swift Version: swift-driver version: 1.87.1 Apple Swift version 5.9 (swiftlang-5.9.0.128.106 clang-1500.0.40.1)
    Target: arm64-apple-macosx13.0
  • Xcode Version: Xcode 15.0, Build version 15A5229m
  • Deployment target: all

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.move-onlyFeature → type declarations: Move-only type declarations

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions