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