fail_deref_function.carbon 1.6 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. 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: constants {
  20. // CHECK:STDOUT: %A: type = fn_type @A [template]
  21. // CHECK:STDOUT: %.1: type = tuple_type () [template]
  22. // CHECK:STDOUT: %struct: A = struct_value () [template]
  23. // CHECK:STDOUT: }
  24. // CHECK:STDOUT:
  25. // CHECK:STDOUT: file {
  26. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  27. // CHECK:STDOUT: .Core = %Core
  28. // CHECK:STDOUT: .A = %A.decl
  29. // CHECK:STDOUT: }
  30. // CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
  31. // CHECK:STDOUT: %A.decl: A = fn_decl @A [template = constants.%struct] {}
  32. // CHECK:STDOUT: }
  33. // CHECK:STDOUT:
  34. // CHECK:STDOUT: fn @A() {
  35. // CHECK:STDOUT: !entry:
  36. // CHECK:STDOUT: %A.ref.loc12: A = name_ref A, file.%A.decl [template = constants.%struct]
  37. // CHECK:STDOUT: %.loc12: ref <error> = deref <error>
  38. // CHECK:STDOUT: %A.ref.loc16: A = name_ref A, file.%A.decl [template = constants.%struct]
  39. // CHECK:STDOUT: %.loc16: ref <error> = deref <error>
  40. // CHECK:STDOUT: return
  41. // CHECK:STDOUT: }
  42. // CHECK:STDOUT: