fail_direct_base_class_init.carbon 579 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. base class A {
  8. var a: i32;
  9. }
  10. class B extends A {
  11. var b: i32;
  12. }
  13. fn Main() -> i32 {
  14. // CHECK:STDERR: COMPILATION ERROR: explorer/testdata/class/fail_direct_base_class_init.carbon:[[@LINE+1]]: type error in initializer of variable: '{.a: i32, .b: i32}' is not implicitly convertible to 'class B'
  15. var b: B = {.a=0, .b=1};
  16. return 0;
  17. }