mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
Make {} as Class an initializing expression. (#6882)
Previously we forced a temporary materialization, resulting in it being
treated as an ephemeral reference expression. This change allows
```carbon
var x: Class = {} as Class;
```
even when `Class` is not copyable.
This commit is contained in:
+4
-4
@@ -657,12 +657,12 @@ fn F() {
|
||||
// CHECK:STDOUT: %ExplicitAndAlsoDeduced.specific_fn: <specific function> = specific_function %ExplicitAndAlsoDeduced.ref, @ExplicitAndAlsoDeduced(constants.%A) [concrete = constants.%ExplicitAndAlsoDeduced.specific_fn.1f3]
|
||||
// CHECK:STDOUT: %.loc11_37.2: ref %A = temporary_storage
|
||||
// CHECK:STDOUT: %.loc11_37.3: init %A to %.loc11_37.2 = class_init () [concrete = constants.%A.val]
|
||||
// CHECK:STDOUT: %.loc11_37.4: ref %A = temporary %.loc11_37.2, %.loc11_37.3
|
||||
// CHECK:STDOUT: %.loc11_37.5: ref %A = converted %.loc11_37.1, %.loc11_37.4
|
||||
// CHECK:STDOUT: %.loc11_37.4: init %A = converted %.loc11_37.1, %.loc11_37.3 [concrete = constants.%A.val]
|
||||
// CHECK:STDOUT: %.loc11_37.5: ref %A = temporary %.loc11_37.2, %.loc11_37.4
|
||||
// CHECK:STDOUT: %.loc11_37.6: %A = acquire_value %.loc11_37.5
|
||||
// CHECK:STDOUT: %ExplicitAndAlsoDeduced.call: init %ptr.643 = call %ExplicitAndAlsoDeduced.specific_fn(%.loc11_37.6)
|
||||
// CHECK:STDOUT: %Destroy.Op.bound: <bound method> = bound_method %.loc11_37.4, constants.%Destroy.Op
|
||||
// CHECK:STDOUT: %Destroy.Op.call: init %empty_tuple.type = call %Destroy.Op.bound(%.loc11_37.4)
|
||||
// CHECK:STDOUT: %Destroy.Op.bound: <bound method> = bound_method %.loc11_37.5, constants.%Destroy.Op
|
||||
// CHECK:STDOUT: %Destroy.Op.call: init %empty_tuple.type = call %Destroy.Op.bound(%.loc11_37.5)
|
||||
// CHECK:STDOUT: return %ExplicitAndAlsoDeduced.call
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
|
||||
Reference in New Issue
Block a user