| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- // Part of the Carbon Language project, under the Apache License v2.0 with LLVM
- // Exceptions. See /LICENSE for license information.
- // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
- //
- // AUTOUPDATE
- fn F() {}
- fn Run() {
- // CHECK:STDERR: fail_empty_tuple_access.carbon:[[@LINE+3]]:3: ERROR: Tuple element index `0` is past the end of type `()`.
- // CHECK:STDERR: F()[0];
- // CHECK:STDERR: ^~~~~~
- F()[0];
- }
- // CHECK:STDOUT: --- fail_empty_tuple_access.carbon
- // CHECK:STDOUT:
- // CHECK:STDOUT: constants {
- // CHECK:STDOUT: %F: type = fn_type @F [template]
- // CHECK:STDOUT: %.1: type = tuple_type () [template]
- // CHECK:STDOUT: %struct.1: F = struct_value () [template]
- // CHECK:STDOUT: %Run: type = fn_type @Run [template]
- // CHECK:STDOUT: %struct.2: Run = struct_value () [template]
- // CHECK:STDOUT: %.2: i32 = int_literal 0 [template]
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: file {
- // CHECK:STDOUT: package: <namespace> = namespace [template] {
- // CHECK:STDOUT: .Core = %Core
- // CHECK:STDOUT: .F = %F.decl
- // CHECK:STDOUT: .Run = %Run.decl
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
- // CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.1] {}
- // CHECK:STDOUT: %Run.decl: Run = fn_decl @Run [template = constants.%struct.2] {}
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @F() {
- // CHECK:STDOUT: !entry:
- // CHECK:STDOUT: return
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @Run() {
- // CHECK:STDOUT: !entry:
- // CHECK:STDOUT: %F.ref: F = name_ref F, file.%F.decl [template = constants.%struct.1]
- // CHECK:STDOUT: %F.call: init () = call %F.ref()
- // CHECK:STDOUT: %.loc13_7: i32 = int_literal 0 [template = constants.%.2]
- // CHECK:STDOUT: %.loc13_4.1: ref () = temporary_storage
- // CHECK:STDOUT: %.loc13_4.2: ref () = temporary %.loc13_4.1, %F.call
- // CHECK:STDOUT: %.loc13_8: ref <error> = tuple_index %.loc13_4.2, <error>
- // CHECK:STDOUT: return
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
|