fail_rhs_assign.carbon 557 B

12345678910111213141516171819
  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. fn Main() -> i32 {
  8. var x: i32;
  9. var y: i32;
  10. if (0 == 1) {
  11. x = 0;
  12. }
  13. // Static analysis thinks `x` may be formed, defer the check to run-time.
  14. // CHECK:STDERR: RUNTIME ERROR: fail_rhs_assign.carbon:[[@LINE+1]]: undefined behavior: access to uninitialized value Uninit<Placeholder<x>>
  15. y = x;
  16. return y;
  17. }