()
| 2 | |
| 3 | #[test] |
| 4 | fn allows_address_of_dereference_place() { |
| 5 | // `@ptr` is a place, so `&@ptr` is a valid (redundant) way to write `ptr`. |
| 6 | let source = r#" |
| 7 | main: () -> i32 { |
| 8 | ptr: i32* = new(i32) |
| 9 | same: i32* = &@ptr |
| 10 | @same = 7 |
| 11 | defer free(ptr) |
| 12 | return @ptr |
| 13 | } |
| 14 | "#; |
| 15 | |
| 16 | let mut pipeline = CompilationPipeline::new(); |
| 17 | pipeline.set_write_artifacts(false); |
| 18 | let result = pipeline.compile(source); |
| 19 | assert!( |
| 20 | result.is_ok(), |
| 21 | "expected `&@ptr` to compile as a place address: {:?}", |
| 22 | result.err() |
| 23 | ); |
| 24 | } |
| 25 | |
| 26 | #[test] |
| 27 | fn allows_address_of_stack_array_element() { |
nothing calls this directly
no test coverage detected