fail_pinned_value_restored.carbon 529 B

123456789101112131415161718
  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. // NOAUTOUPDATE
  6. package ExplorerTest api;
  7. fn Main() -> i32 {
  8. let original: i32 = 1;
  9. var a: i32 = original;
  10. let a_pinned: i32 = a;
  11. a = 2;
  12. a = original;
  13. // CHECK:STDERR: RUNTIME ERROR: fail_pinned_value_restored.carbon:[[@LINE+1]]: Reference has changed since this value was bound.
  14. Print("{0}", a_pinned);
  15. return 0;
  16. }