[SR-3024] Cannot use #if swift(>=3.0.1) compiler directive #45614
Labels
compiler directives
Feature: compiler directives (#if, #warning, #error, etc.)
compiler
The Swift compiler in itself
duplicate
Resolution: Duplicates another issue
feature
A feature request or implementation
improvement
Additional Detail from JIRA
md5: 06b1747e0a82f0393913752d2fe143d0
duplicates:
#if swift(>=3.0.1)
Issue Description:
Swift 3.0.1 changes the UnsafePointer.withMemoryRebound method to take a closure that takes an UnsafeBuffer instead of an UnsafeMutablePointer - as was the case in Swift 3.0.
Because I have code that needs to be compiled in both Xcode 8 and 8.1 I would like to use the #if swift() compiler directive to detect Swift 3.0 vs Swift 3.0.1 and then conditionalise the code that uses withMemoryRebound to compile under both compilers.
Unfortunately the #if swift() directive does not allow me to detect the difference between the two versions and instead I get:
```
/Users/schwa/Projects/SwiftUtilities/Source/UnsafeBufferPointers.swift:52:17: error: expected named member of numeric literal
#if swift(>=3.0.1)
~~~ ^
```
I would expect either that 3.0.1 is not an API breaking release. Or that I am able to detect differences between compilers at a more fine grained level than I am provided with #if swift
(Also posted as rdar://28905799)
The text was updated successfully, but these errors were encountered: