fail_deref_function.carbon 1.2 KB

123456789101112131415161718192021222324252627282930313233343536
  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. fn A() {
  7. // CHECK:STDERR: fail_deref_function.carbon:[[@LINE+4]]:4: ERROR: Expression cannot be used as a value.
  8. // CHECK:STDERR: *A;
  9. // CHECK:STDERR: ^
  10. // CHECK:STDERR:
  11. *A;
  12. // CHECK:STDERR: fail_deref_function.carbon:[[@LINE+3]]:3: ERROR: Expression cannot be used as a value.
  13. // CHECK:STDERR: A->foo;
  14. // CHECK:STDERR: ^
  15. A->foo;
  16. }
  17. // CHECK:STDOUT: --- fail_deref_function.carbon
  18. // CHECK:STDOUT:
  19. // CHECK:STDOUT: file {
  20. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  21. // CHECK:STDOUT: .A = %A
  22. // CHECK:STDOUT: }
  23. // CHECK:STDOUT: %A: <function> = fn_decl @A [template] {}
  24. // CHECK:STDOUT: }
  25. // CHECK:STDOUT:
  26. // CHECK:STDOUT: fn @A() {
  27. // CHECK:STDOUT: !entry:
  28. // CHECK:STDOUT: %A.ref.loc12: <function> = name_ref A, file.%A [template = file.%A]
  29. // CHECK:STDOUT: %.loc12: ref <error> = deref <error>
  30. // CHECK:STDOUT: %A.ref.loc16: <function> = name_ref A, file.%A [template = file.%A]
  31. // CHECK:STDOUT: %.loc16: ref <error> = deref <error>
  32. // CHECK:STDOUT: return
  33. // CHECK:STDOUT: }
  34. // CHECK:STDOUT: