// RUN: %swift -parse -verify %s

// Test that the C*Pointer types support all of the expected conversions.

func takeConstPointer(p: CConstPointer<Int>) {} // expected-note{{}}

var mutable: Int = 0
let immutable: Int = 0
var differentType: Double = 0
var arr: Int[] = [0]
let ptr: UnsafePointer<Int> = nil

takeConstPointer(nil)
takeConstPointer(&mutable)
takeConstPointer(immutable) // expected-error{{}}
takeConstPointer(&differentType) // expected-error{{}}
takeConstPointer(arr)
takeConstPointer([0])
takeConstPointer(ptr)

func takeMutablePointer(p: CMutablePointer<Int>) {} // expected-note{{}}

takeMutablePointer(nil)
takeMutablePointer(&mutable)
takeMutablePointer(immutable) // expected-error{{}}
takeMutablePointer(&differentType) // expected-error{{}}
takeMutablePointer(arr) // expected-error{{}}
takeMutablePointer(&arr)
takeMutablePointer([0]) // expected-error{{}}
takeMutablePointer(ptr)

Implement implicit conversions to C*Pointer types.
stdlib: Implement implicit conversions to C*Pointer types.

Make CConstPointer<T> convertible from UnsafePointer<T>, inout T, and Array<T>, and nil; and make CMutablePointer<T> convertible from UnsafePointer<T>, inout T, inout Array<T>, and nil.

Swift SVN r15600
