fail_modify_in_constant_expr.carbon 699 B

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