We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NRVO doesn't happen when return type contains an array
when defined case7: # D20200427T030626 type X1 = object a1: array[10,int] # no NRVO type X2 = object a2: seq[int] # NRVO proc fun1(): X1 = discard proc fun2(): X2 = discard proc main = var x1 = fun1() var x2 = fun2() main()
cgen'd file shows:
N_LIB_PRIVATE N_NIMCALL(void, main__Txk9aMBuTQfWSxCVsnz9cpLw)(void) { tyObject_X1__8Rt52S9caw66JoaF6ps17vQ x1; tyObject_X2__HENPt9b0VcoiqRd762A4dqg x2; x1 = fun1__Mn2tcNiI7WmB3YthDb2xNA(); nimZeroMem((void*)(&x2), sizeof(tyObject_X2__HENPt9b0VcoiqRd762A4dqg)); fun2__opw8oBRugVywaf9af9cJzLnA((&x2)); }
x1 = fun1__Mn2tcNiI7WmB3YthDb2xNA(); should be: fun1__Mn2tcNiI7WmB3YthDb2xNA(&1);
x1 = fun1__Mn2tcNiI7WmB3YthDb2xNA();
fun1__Mn2tcNiI7WmB3YthDb2xNA(&1);
result
The text was updated successfully, but these errors were encountered:
No branches or pull requests
NRVO doesn't happen when return type contains an array
Example
Current Output
cgen'd file shows:
Expected Output
x1 = fun1__Mn2tcNiI7WmB3YthDb2xNA();
should be:
fun1__Mn2tcNiI7WmB3YthDb2xNA(&1);
Possible Solution
Additional Information
result
guarantee NRVO? - Nim forumThe text was updated successfully, but these errors were encountered: