fail_collapse.carbon 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637
  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. // CHECK:STDERR: fail_collapse.carbon:[[@LINE+3]]:9: `const` applied repeatedly to the same type has no additional effect.
  7. // CHECK:STDERR: fn G(p: const (const i32)**) -> i32** {
  8. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~
  9. fn G(p: const (const i32)**) -> i32** {
  10. // CHECK:STDERR: fail_collapse.carbon:[[@LINE+3]]:3: ERROR: Cannot implicitly convert from `const i32**` to `i32**`.
  11. // CHECK:STDERR: return p;
  12. // CHECK:STDERR: ^~~~~~~~~
  13. return p;
  14. }
  15. // CHECK:STDOUT: --- fail_collapse.carbon
  16. // CHECK:STDOUT:
  17. // CHECK:STDOUT: constants {
  18. // CHECK:STDOUT: %.1: type = const_type i32 [template]
  19. // CHECK:STDOUT: %.2: type = ptr_type const i32 [template]
  20. // CHECK:STDOUT: %.3: type = ptr_type const i32* [template]
  21. // CHECK:STDOUT: %.4: type = ptr_type i32 [template]
  22. // CHECK:STDOUT: %.5: type = ptr_type i32* [template]
  23. // CHECK:STDOUT: }
  24. // CHECK:STDOUT:
  25. // CHECK:STDOUT: file {
  26. // CHECK:STDOUT: package: <namespace> = namespace {.G = %G} [template]
  27. // CHECK:STDOUT: %G: <function> = fn_decl @G [template]
  28. // CHECK:STDOUT: }
  29. // CHECK:STDOUT:
  30. // CHECK:STDOUT: fn @G(%p: const i32**) -> i32** {
  31. // CHECK:STDOUT: !entry:
  32. // CHECK:STDOUT: %p.ref: const i32** = name_ref p, %p
  33. // CHECK:STDOUT: return <error>
  34. // CHECK:STDOUT: }
  35. // CHECK:STDOUT: