roundtrip.carbon 1009 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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/none.carbon
  6. //
  7. // AUTOUPDATE
  8. // TIP: To test this file alone, run:
  9. // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/class/roundtrip.carbon
  10. // TIP: To dump output, run:
  11. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/class/roundtrip.carbon
  12. // --- carbon_to_cpp_to_carbon.carbon
  13. library "[[@TEST_NAME]]";
  14. import Cpp;
  15. class C {}
  16. inline Cpp '''
  17. using CAlias = Carbon::C;
  18. ''';
  19. fn F(p: C*) {
  20. let unused q: Cpp.CAlias* = p;
  21. }
  22. // --- cpp_to_carbon_to_cpp.carbon
  23. library "[[@TEST_NAME]]";
  24. import Cpp;
  25. inline Cpp '''
  26. class C {};
  27. ''';
  28. alias CAlias = Cpp.C;
  29. inline Cpp '''
  30. auto F(C *p) -> Carbon::CAlias* {
  31. return p;
  32. }
  33. ''';