fail_modify_in_constant_expr.carbon 619 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. package ExplorerTest api;
  7. var n: i32 = 0;
  8. fn F() -> type {
  9. // TODO: This isn't a very good description of the problem, which is that
  10. // compile-time evaluation doesn't have a mutable `n` value available.
  11. // CHECK:STDERR: COMPILATION ERROR: explorer/testdata/var/global/fail_modify_in_constant_expr.carbon:[[@LINE+1]]: could not find `n: i32`
  12. n = 1;
  13. return i32;
  14. }
  15. fn Main() -> F() {
  16. return n;
  17. }