fail_point_equal.carbon 581 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. class Point(T:! type) {
  8. var x: T;
  9. var y: T;
  10. }
  11. fn Main() -> i32 {
  12. var p: Point(i32) = {.x = 0, .y = 0};
  13. // CHECK:STDERR: COMPILATION ERROR: fail_point_equal.carbon:[[@LINE+1]]: type error in initializer of variable: 'class Point(T = i32)' is not implicitly convertible to 'class Point(T = bool)'
  14. var q: Point(bool) = p;
  15. return 0;
  16. }