mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
A parse-only option is needed for parse performance tracking and the current option also includes semantic analysis.
44 lines
1.5 KiB
Swift
44 lines
1.5 KiB
Swift
// RUN: %target-typecheck-verify-swift
|
|
|
|
@_alignment(16)
|
|
struct Float4 {
|
|
var x, y, z, w: Float
|
|
}
|
|
@_alignment(1)
|
|
struct AnyAlignment {}
|
|
@_alignment(1)
|
|
enum AnyAlignmentEnum {}
|
|
|
|
|
|
@_alignment // expected-error{{expected '('}}
|
|
struct DidntSpecifyAlignment {}
|
|
|
|
@_alignment() // expected-error{{must be a positive integer literal}} expected-error{{expected declaration}}
|
|
struct DidntSpecifyAlignment2 {}
|
|
|
|
@_alignment("sixteen") // expected-error{{must be a positive integer literal}} expected-error{{expected declaration}}
|
|
struct SpecifiedJunkAlignment {}
|
|
|
|
@_alignment(-1) // expected-error{{must be a positive integer literal}} expected-error{{expected declaration}}
|
|
struct NegativeAlignment {}
|
|
|
|
@_alignment(0) // expected-error{{must be a power of two}}
|
|
struct ZeroAlignment {}
|
|
|
|
@_alignment(3) // expected-error{{must be a power of two}}
|
|
struct NonPowerOfTwoAlignment {}
|
|
|
|
@_alignment(3.5) // expected-error{{must be a positive integer literal}} expected-error{{expected declaration}}
|
|
struct FractionalAlignment {}
|
|
|
|
@_alignment(16) // expected-error{{cannot be applied to this declaration}} {{1-17=}}
|
|
class ClassWithAlignment {}
|
|
|
|
@_alignment(16) // expected-error{{cannot be applied to this declaration}} {{1-17=}}
|
|
protocol ProtocolWithAlignment {}
|
|
|
|
struct Foo {
|
|
@_alignment(16) var fieldWithAlignment: Int // expected-error{{cannot be applied to this declaration}} {{3-19=}}
|
|
@_alignment(16) func funcWithAlignment() {} // expected-error{{cannot be applied to this declaration}} {{3-19=}}
|
|
}
|