Cannot have multiple swift extensions on an imported C type
| Originator: | jwight | ||
| Number: | rdar://21314681 | Date Originated: | 6/9/2015 |
| Status: | Open | Resolved: | |
| Product: | Dev Tools | Product Version: | 7 |
| Classification: | Reproducible: |
Summary:
Radar issue #19590451 fixes a problem where it was impossible to add a typealias to an imported C struct (in this case a CGPoint) with Swift 1.2.
This problem is fixed in Swift 2.0, however it exposes a problem where if I add another extension to the original type (again CGPoint) the linker fails - claiming that I have duplicate symbols.
Steps to Reproduce:
1 Run included project (oops: change the println to print - my bad)
2 Note that linker fails with a duplicate symbol.
3 Comment out the extension in CGPoint+Bogus.swift
4 Note the linker succeeds!
Expected Results:
Expect to be able to add extensions to an imported C type just as I would any other Swift type.
Actual Results:
duplicate symbol __TFFVSC7CGPointm1yV12CoreGraphics7CGFloatU_FTBpRBBRS_MS__T_ in:
/Users/schwa/Library/Developer/Xcode/DerivedData/Test-bpmronwzxaqjvzfcrsxbwzxscxrv/Build/Intermediates/Test.build/Debug/Test.build/Objects-normal/x86_64/CGPoint+Bogus.o
/Users/schwa/Library/Developer/Xcode/DerivedData/Test-bpmronwzxaqjvzfcrsxbwzxscxrv/Build/Intermediates/Test.build/Debug/Test.build/Objects-normal/x86_64/CGPoint+Extensions.o
duplicate symbol __TFFVSC7CGPointm1xV12CoreGraphics7CGFloatU_FTBpRBBRS_MS__T_ in:
/Users/schwa/Library/Developer/Xcode/DerivedData/Test-bpmronwzxaqjvzfcrsxbwzxscxrv/Build/Intermediates/Test.build/Debug/Test.build/Objects-normal/x86_64/CGPoint+Bogus.o
/Users/schwa/Library/Developer/Xcode/DerivedData/Test-bpmronwzxaqjvzfcrsxbwzxscxrv/Build/Intermediates/Test.build/Debug/Test.build/Objects-normal/x86_64/CGPoint+Extensions.o
ld: 2 duplicate symbols for architecture x86_64
Version:
Version 7.0 beta (7A120f)
Notes:
Configuration:
Attachments:
'CGPointTest.zip' was successfully uploaded.
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!