示例

int function(int &a, int &b){
a++;   
return b;
}

解决方案
尽可能使用 const 关键字以便编译器强制不修改变量。

int function(int &a, const int &b){
a++;   
return b;
}