nested_const.carbon 1.0 KB

123456789101112131415161718192021222324252627
  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. // TODO: The `const` in the return type should not be necessary.
  7. fn F(p: const (const (const i32*)*)) -> const i32 {
  8. return **p;
  9. }
  10. // CHECK:STDOUT: --- nested_const.carbon
  11. // CHECK:STDOUT:
  12. // CHECK:STDOUT: file {
  13. // CHECK:STDOUT: %F: <function> = fn_decl @F
  14. // CHECK:STDOUT: }
  15. // CHECK:STDOUT:
  16. // CHECK:STDOUT: fn @F(%p: const (const (const i32*)*)) -> const i32 {
  17. // CHECK:STDOUT: !entry:
  18. // CHECK:STDOUT: %p.ref: const (const (const i32*)*) = name_ref p, %p
  19. // CHECK:STDOUT: %.loc9_11.1: ref const (const i32*) = deref %p.ref
  20. // CHECK:STDOUT: %.loc9_11.2: const (const i32*) = bind_value %.loc9_11.1
  21. // CHECK:STDOUT: %.loc9_10.1: ref const i32 = deref %.loc9_11.2
  22. // CHECK:STDOUT: %.loc9_10.2: const i32 = bind_value %.loc9_10.1
  23. // CHECK:STDOUT: return %.loc9_10.2
  24. // CHECK:STDOUT: }
  25. // CHECK:STDOUT: