checker: allow for `unsafe {*(p+1) = 22}` (#10557)
							parent
							
								
									5a308005d5
								
							
						
					
					
						commit
						8324a766e8
					
				|  | @ -1599,6 +1599,9 @@ fn (mut c Checker) fail_if_immutable(expr ast.Expr) (string, token.Position) { | |||
| 		ast.StructInit { | ||||
| 			return '', pos | ||||
| 		} | ||||
| 		ast.InfixExpr { | ||||
| 			return '', pos | ||||
| 		} | ||||
| 		else { | ||||
| 			if !expr.is_lit() { | ||||
| 				c.error('unexpected expression `$expr.type_name()`', expr.position()) | ||||
|  |  | |||
|  | @ -7,6 +7,8 @@ fn test_pointer_arithmetic() { | |||
| 		assert 2 == *parr | ||||
| 		parr++ | ||||
| 		assert 3 == *parr | ||||
| 		parr_add_one := *(parr + 1) | ||||
| 		assert parr_add_one == 4 | ||||
| 		assert *(parr + 1) == 4 | ||||
| 	} | ||||
| } | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue