fail_not_copyable.carbon 1.1 KB

1234567891011121314151617181920212223242526
  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/full.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/var/fail_not_copyable.carbon
  10. // TIP: To dump output, run:
  11. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/var/fail_not_copyable.carbon
  12. class X {
  13. }
  14. fn F(x: X) {
  15. // TODO: Decide on rules for when classes are copyable.
  16. // CHECK:STDERR: fail_not_copyable.carbon:[[@LINE+7]]:14: error: cannot copy value of type `X` [CopyOfUncopyableType]
  17. // CHECK:STDERR: var y: X = x;
  18. // CHECK:STDERR: ^
  19. // CHECK:STDERR: fail_not_copyable.carbon:[[@LINE+4]]:14: note: type `X` does not implement interface `Core.Copy` [MissingImplInMemberAccessNote]
  20. // CHECK:STDERR: var y: X = x;
  21. // CHECK:STDERR: ^
  22. // CHECK:STDERR:
  23. var y: X = x;
  24. }