Hello all, The attached patch adds a test-case for which incorrect code is generated and a change which makes the test pass.
>From what I could tell the following happened: 1. Sema::computeNRVO marked a variable as suitable for NRVO 2. CodeGenFunction::EmitAutoVarAlloca handled allocating variables to the return slot based on getLangOpts().ElideConstructors and the flag set by Sema. 3. CodeGenFunction::EmitReturnStmt only looked at the flag set by Sema to determine if necessary to emit a return statement. The patch changes EmitReturnStmt to require that the ElideConstructors flag is set to perform NRVO. Another option (which perhaps is better) would be to let Sema::computeNRVO return early if ElideConstructors wasn't set and remove the ElideConstructors check within EmitAutoVarAlloca. Since I haven't worked with this code before I opted for the least intrusive change. Best regards David
pr12208.patch
Description: Binary data
_______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
