thunk_cpp26.carbon 1015 B

12345678910111213141516171819202122232425262728
  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/int.carbon
  6. // EXTRA-ARGS: --clang-arg=--std=c++26
  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/function/import/thunk_cpp26.carbon
  11. // TIP: To dump output, run:
  12. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/function/import/thunk_cpp26.carbon
  13. // --- thunk_required.h
  14. auto foo(short a) -> short;
  15. // --- import_thunk_required.carbon
  16. library "[[@TEST_NAME]]";
  17. import Cpp library "thunk_required.h";
  18. fn F() {
  19. // Placement operator new is `constexpr` in C++26. But that shouldn't cause
  20. // problems for us because we declare our own operator new.
  21. Cpp.foo(1 as i16);
  22. }