mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-11-16 20:48:12 +00:00
This removes special-casing of empty structs, handling them as just a regular value instead of a builtin. Note the `{} as Type` is still special-cased.
In lowering, removes the test of calling a function using `{}` because it's missing the proper load/store. This setup notices that error whereas the prior worked due to said special-casing. Fixing this will need to be done as part of generally adding loads for variable uses.
30 lines
1.1 KiB
Plaintext
30 lines
1.1 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:STDOUT: ; ModuleID = 'empty.carbon'
|
|
// CHECK:STDOUT: source_filename = "empty.carbon"
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: %StructLiteralType = type {}
|
|
// CHECK:STDOUT: %StructLiteralType.0 = type {}
|
|
// CHECK:STDOUT: %StructLiteralType.1 = type {}
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: define i32 @Run() {
|
|
// CHECK:STDOUT: entry:
|
|
// CHECK:STDOUT: %StructLiteralValue = alloca %StructLiteralType, align 8
|
|
// CHECK:STDOUT: %var = alloca %StructLiteralType, align 8
|
|
// CHECK:STDOUT: %StructLiteralValue1 = alloca %StructLiteralType.0, align 8
|
|
// CHECK:STDOUT: store ptr %StructLiteralValue1, ptr %var, align 8
|
|
// CHECK:STDOUT: %StructLiteralValue2 = alloca %StructLiteralType.1, align 8
|
|
// CHECK:STDOUT: %var3 = alloca %StructLiteralType.1, align 8
|
|
// CHECK:STDOUT: store ptr %var, ptr %var3, align 8
|
|
// CHECK:STDOUT: ret i32 0
|
|
// CHECK:STDOUT: }
|
|
|
|
fn Run() -> i32 {
|
|
var x: {} = {};
|
|
var y: {} = x;
|
|
return 0;
|
|
}
|