Swift: CGFloat and CFloat are not always compatible

Originator:josh.hinman
Number:rdar://17498158 Date Originated:28-Jun-2014
Status:Open Resolved:
Product:Developer Tools Product Version:
Classification: Reproducible:Always
 
Summary:
CGFloat is supposed to be a typealias for CFloat, but math.h functions that accept a CFloat will not always accept a CGFloat

Steps to Reproduce:
Type this into a playground:

import CoreGraphics

let f1: CGFloat = 5
let f2: CGFloat = 6

fminf(f1, f2)

Expected Results:
The program should compile and return "5"

Actual Results:
Error: 'CGFloat' is not convertable to 'CFloat'

It gets even weirder when you "import Foundation". Then the error becomes: 'NSNumber' is not a subtype of 'CFloat'

Version:
Xcode 6.0 (6A216f)

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!