fail_invalid_subtyping.carbon 511 B

1234567891011121314151617181920
  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 C {
  8. }
  9. class D {
  10. }
  11. fn Main() -> i32 {
  12. var d: D = {};
  13. // CHECK:STDERR: COMPILATION ERROR: fail_invalid_subtyping.carbon:[[@LINE+1]]: type error in initializer of variable: 'class D*' is not implicitly convertible to 'class C*'
  14. var c: C* = &d;
  15. return 0;
  16. }