mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-09-27 07:00:13 +01:00
35 lines
1.3 KiB
Plaintext
35 lines
1.3 KiB
Plaintext
// 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
|
|
|
|
// CHECK:STDERR: fail_assign_empty.carbon:[[@LINE+3]]:20: ERROR: Cannot initialize struct with 1 field(s) from struct with 0 field(s).
|
|
// CHECK:STDERR: var x: {.a: i32} = {};
|
|
// CHECK:STDERR: ^~
|
|
var x: {.a: i32} = {};
|
|
|
|
// CHECK:STDOUT: --- fail_assign_empty.carbon
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: constants {
|
|
// CHECK:STDOUT: %.1: type = struct_type {.a: i32} [template]
|
|
// CHECK:STDOUT: %.2: type = struct_type {} [template]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: file {
|
|
// CHECK:STDOUT: package: <namespace> = namespace [template] {
|
|
// CHECK:STDOUT: .x = %x
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %.loc10: type = struct_type {.a: i32} [template = constants.%.1]
|
|
// CHECK:STDOUT: %x.var: ref {.a: i32} = var x
|
|
// CHECK:STDOUT: %x: ref {.a: i32} = bind_name x, %x.var
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: fn @__global_init() {
|
|
// CHECK:STDOUT: !entry:
|
|
// CHECK:STDOUT: %.loc10: {} = struct_literal ()
|
|
// CHECK:STDOUT: assign file.%x.var, <error>
|
|
// CHECK:STDOUT: return
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|