fail_addr.carbon 567 B

12345678910111213141516171819202122
  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. package ExplorerTest impl;
  7. class A {
  8. destructor[addr self: Self*] {
  9. self->n += 1;
  10. Print("DESTRUCTOR A {0}", self->n);
  11. // CHECK:STDERR: RUNTIME ERROR: explorer/testdata/destructor/fail_addr.carbon:[[@LINE+1]]: destructors currently don't support `addr self` bindings
  12. }
  13. var n: i32;
  14. }
  15. fn Main() -> i32 {
  16. var a: A = {.n = 2};
  17. return 0;
  18. }