Closed
Description
This Cpp2 code
global: i32 = 42;
forward_return_literal: () -> forward _ = {
return 1;
}
forward_return_rvalue: () -> forward _ = {
return global + 1;
}
compiles to
cpp2::i32 global {42};
[[nodiscard]] auto forward_return_literal() -> auto&&{
return 1;
}
[[nodiscard]] auto forward_return_rvalue() -> auto&&{
return global + 1;
}
which is problematic Cpp1. We should err when forward returning literals and rvalues.