mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-09-24 22:02:23 +01:00
When returning a value from a function whose return type has a by-copy initializing representation, perform initialization like we do when the return type has an in-place initializing representation. This makes our SemIR representation more uniform, as the return expression will now always be an initializing expression rather than a value expression, but more importantly it means that attempts to return a non-copyable type by value now fail, even if the type has a by-copy initializing representation. This catches a bunch of places where we were returning a value of an unconstrained template parameter `T:! type`, which we were incorrectly allowing because we didn't notice it was not copyable. Unfortunately this then requires quite a few test updates. Like #6034, this exposes a lowering issue where lowering crashes when attempting to lower a specific copy operation for certain types; a couple more tests are temporarily disabled here. An upcoming PR dependent on this one will fix the issue and re-enable those tests.