nondeduced_generic_param.carbon 408 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. // CHECK:STDOUT: result: 1
  7. package ExplorerTest api;
  8. class A(T:! type) {
  9. var v: T;
  10. }
  11. fn F(T:! type, x: T) -> T {
  12. var v: A(T) = {.v = x};
  13. return v.v;
  14. }
  15. fn Main() -> i32 {
  16. return F(i32, 1);
  17. }