Hi,
I've noticed this topic where dangers of passing non-reference types as &inout were described. However, I believe there is no danger in passing non-reference types as &inout when the referenced values are located on the stack. Consider a simple example:
void foo(int &inout a)
{
a = 1;
}
void bar()
{
int a;
// I believe this is always safe
foo(a);
// a is now 1
}
Since the value passed in bar() is located on the stack which is inaccessible by foo(), I believe there's no way a corruption can occur.
While this use case is specific, this covers a very common idiom, and I believe allowing this by default could be quite beneficial. What do you think?