nested_const.carbon 905 B

1234567891011121314151617181920212223
  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: file "nested_const.carbon" {
  11. // CHECK:STDOUT: %.loc8 = fn_decl @F
  12. // CHECK:STDOUT: }
  13. // CHECK:STDOUT:
  14. // CHECK:STDOUT: fn @F(%p: const (const (const i32*)*)) -> const i32 {
  15. // CHECK:STDOUT: !entry:
  16. // CHECK:STDOUT: %.loc9_11.1: ref const (const i32*) = dereference %p
  17. // CHECK:STDOUT: %.loc9_11.2: const (const i32*) = bind_value %.loc9_11.1
  18. // CHECK:STDOUT: %.loc9_10.1: ref const i32 = dereference %.loc9_11.2
  19. // CHECK:STDOUT: %.loc9_10.2: const i32 = bind_value %.loc9_10.1
  20. // CHECK:STDOUT: return %.loc9_10.2
  21. // CHECK:STDOUT: }