fail_missing_addr.carbon 567 B

123456789101112131415161718192021
  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. // NOAUTOUPDATE
  6. package ExplorerTest api;
  7. class Foo {
  8. fn Bar[self: Foo*]() {
  9. self->x += 1;
  10. }
  11. var x: i32;
  12. }
  13. fn Main() -> i32 {
  14. var foo: Foo = {.x = 0};
  15. // CHECK:STDERR: COMPILATION ERROR: fail_missing_addr.carbon:[[@LINE+1]]: method foo.Bar does not match the target function's self pattern (did you forget an `addr`?)
  16. foo.Bar();
  17. return 0;
  18. }