pinned_value_mutation_unread_data.carbon 444 B

123456789101112131415161718192021
  1. // Part of the Carbon Language project, under the Apache License v2.0 with LLVM
  2. // Exceptions. See /LICENSE for license information.
  3. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. //
  5. // AUTOUPDATE
  6. // CHECK:STDOUT: 1
  7. // CHECK:STDOUT: result: 0
  8. package ExplorerTest api;
  9. fn Foo(n: i32) {
  10. Print("{0}", n);
  11. }
  12. fn Main() -> i32 {
  13. var v: {.a: i32, .b: i32} = {.a = 1, .b = 2};
  14. let a: i32 = v.a;
  15. v.b = 3;
  16. Foo(a);
  17. return 0;
  18. }