rust/tests/ui/repr/repr-align.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

34 lines
1.3 KiB
Rust
Raw Normal View History

#![allow(dead_code)]
#[repr(align(16.0))] //~ ERROR: invalid `repr(align)` attribute: not an unsuffixed integer
2020-01-08 11:02:10 -06:00
//~| ERROR: invalid `repr(align)` attribute: not an unsuffixed integer
2019-05-27 00:35:48 -05:00
struct S0(i32);
#[repr(align(15))] //~ ERROR: invalid `repr(align)` attribute: not a power of two
2020-01-08 11:02:10 -06:00
//~| ERROR: invalid `repr(align)` attribute: not a power of two
2019-05-27 00:35:48 -05:00
struct S1(i32);
#[repr(align(4294967296))] //~ ERROR: invalid `repr(align)` attribute: larger than 2^29
2020-01-08 11:02:10 -06:00
//~| ERROR: invalid `repr(align)` attribute: larger than 2^29
2019-05-27 00:35:48 -05:00
struct S2(i32);
#[repr(align(536870912))] // ok: this is the largest accepted alignment
2019-05-27 00:35:48 -05:00
struct S3(i32);
#[repr(align(16.0))] //~ ERROR: invalid `repr(align)` attribute: not an unsuffixed integer
2020-01-08 11:02:10 -06:00
//~| ERROR: invalid `repr(align)` attribute: not an unsuffixed integer
2019-05-27 00:35:48 -05:00
enum E0 { A, B }
#[repr(align(15))] //~ ERROR: invalid `repr(align)` attribute: not a power of two
2020-01-08 11:02:10 -06:00
//~| ERROR: invalid `repr(align)` attribute: not a power of two
2019-05-27 00:35:48 -05:00
enum E1 { A, B }
#[repr(align(4294967296))] //~ ERROR: invalid `repr(align)` attribute: larger than 2^29
2020-01-08 11:02:10 -06:00
//~| ERROR: invalid `repr(align)` attribute: larger than 2^29
2019-05-27 00:35:48 -05:00
enum E2 { A, B }
#[repr(align(536870912))] // ok: this is the largest accepted alignment
enum E3 { A, B }
fn main() {}