fail_addr_not_self.carbon 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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. class Class {
  7. // CHECK:STDERR: fail_addr_not_self.carbon:[[@LINE+3]]:8: ERROR: `addr` can only be applied to a `self` parameter.
  8. // CHECK:STDERR: fn F[addr a: Class*]();
  9. // CHECK:STDERR: ^~~~
  10. fn F[addr a: Class*]();
  11. // CHECK:STDERR: fail_addr_not_self.carbon:[[@LINE+3]]:8: ERROR: `addr` can only be applied to a `self` parameter.
  12. // CHECK:STDERR: fn G(addr b: Class*);
  13. // CHECK:STDERR: ^~~~
  14. fn G(addr b: Class*);
  15. }
  16. // CHECK:STDOUT: --- fail_addr_not_self.carbon
  17. // CHECK:STDOUT:
  18. // CHECK:STDOUT: constants {
  19. // CHECK:STDOUT: %Class: type = class_type @Class [template]
  20. // CHECK:STDOUT: %.1: type = ptr_type Class [template]
  21. // CHECK:STDOUT: %.2: type = struct_type {} [template]
  22. // CHECK:STDOUT: }
  23. // CHECK:STDOUT:
  24. // CHECK:STDOUT: file {
  25. // CHECK:STDOUT: package: <namespace> = namespace {.Class = %Class.decl} [template]
  26. // CHECK:STDOUT: %Class.decl = class_decl @Class, ()
  27. // CHECK:STDOUT: }
  28. // CHECK:STDOUT:
  29. // CHECK:STDOUT: class @Class {
  30. // CHECK:STDOUT: %F: <function> = fn_decl @F [template]
  31. // CHECK:STDOUT: %G: <function> = fn_decl @G [template]
  32. // CHECK:STDOUT:
  33. // CHECK:STDOUT: !members:
  34. // CHECK:STDOUT: .F = %F
  35. // CHECK:STDOUT: .G = %G
  36. // CHECK:STDOUT: }
  37. // CHECK:STDOUT:
  38. // CHECK:STDOUT: fn @F[%a: Class*]();
  39. // CHECK:STDOUT:
  40. // CHECK:STDOUT: fn @G(%b: Class*);
  41. // CHECK:STDOUT: