fail_wrong_variable_substituation.carbon 611 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. // RUN: %{not} %{explorer-run}
  7. // RUN: %{not} %{explorer-run-trace}
  8. package Foo api;
  9. class X{
  10. }
  11. fn Get[T:! ()](n: T) -> i32 { return 2; }
  12. fn Main() -> i32 {
  13. var x : X = {};
  14. // CHECK:STDERR: COMPILATION ERROR: {{.*}}/explorer/testdata/generic_function/fail_wrong_variable_substituation.carbon:[[@LINE+1]]: cannot convert deduced value class X for T to parameter type ()
  15. Get(x);
  16. return 0;
  17. }