generic_call.carbon 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738
  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. // INCLUDE-FILE: toolchain/testing/testdata/min_prelude/convert.carbon
  6. // EXTRA-ARGS: --clang-arg=--std=c++20
  7. //
  8. // AUTOUPDATE
  9. // TIP: To test this file alone, run:
  10. // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/template/generic_call.carbon
  11. // TIP: To dump output, run:
  12. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/template/generic_call.carbon
  13. // --- header.h
  14. struct X {};
  15. template<typename T> struct S {};
  16. // --- fail_todo_generic_call.carbon
  17. library "[[@TEST_NAME]]";
  18. import Cpp library "header.h";
  19. fn F[T:! type](x: T) {
  20. // TODO: This should be treated as being template-dependent on T,
  21. // and we should perform the call during monomorphization.
  22. // CHECK:STDERR: fail_todo_generic_call.carbon:[[@LINE+4]]:16: error: semantics TODO: `unsupported type used as template argument` [SemanticsTodo]
  23. // CHECK:STDERR: var v: Cpp.S(T);
  24. // CHECK:STDERR: ^
  25. // CHECK:STDERR:
  26. var v: Cpp.S(T);
  27. }
  28. fn G() {
  29. F({} as Cpp.X);
  30. }