Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SR-7898] [4.2 regression] can't use & to make UnsafeMutableRawPointer in switch case #50433

Closed
mayoff opened this issue Jun 6, 2018 · 2 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself regression swift 4.2

Comments

@mayoff
Copy link

mayoff commented Jun 6, 2018

Previous ID SR-7898
Radar None
Original Reporter @mayoff
Type Bug
Status Closed
Resolution Duplicate
Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, 4.2Regression
Assignee None
Priority Medium

md5: e284e3cb4512c3c07b192745ad34e47c

duplicates:

  • SR-7877 4.2: Pointer-to-context source compatibility regression

Issue Description:

Consider the following program:

var kvoContext = 0

func f(_ context: UnsafeMutableRawPointer?) {
    switch context {
    case &kvoContext: print("match")
    default: print("not")
    }
}

f(&kvoContext)

In the swiftc (in Swift 4 mode) that comes with Xcode 9.4, the program compiles and runs correctly.

In the swiftc (in both Swift 4.1 and Swift 4.2 mode) that comes with Xcode 10 beta, the program fails to compile:

error: repl.swift:5:10: error: use of extraneous '&'
    case &kvoContext: print("match")
@belkadan
Copy link
Contributor

belkadan commented Jun 6, 2018

@rudkx and @xedin have a dup for this, I think.

@xedin
Copy link
Member

xedin commented Jun 7, 2018

Thanks, @belkadan, Added duplicate SR.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself regression swift 4.2
Projects
None yet
Development

No branches or pull requests

4 participants