================
@@ -16174,8 +16174,10 @@ void Sema::computeNRVO(Stmt *Body, FunctionScopeInfo 
*Scope) {
   for (unsigned I = 0, E = Scope->Returns.size(); I != E; ++I) {
     if (const VarDecl *NRVOCandidate = Returns[I]->getNRVOCandidate()) {
       if (!NRVOCandidate->isNRVOVariable()) {
-        Diag(Returns[I]->getRetValue()->getExprLoc(),
-             diag::warn_not_eliding_copy_on_return);
+        if (getLangOpts().CPlusPlus) {
----------------
javiermunozkirschberg wrote:

One question, after the Diag, and as part of if(!NRVOCandidate) there is a 
          Returns[I]->setNRVOCandidate(nullptr);    

If I merge the two ifs(), then diag will be skip, but 
returns[i]->setNRVOCandidate(nullptr) will be also skipped. Is that ok?

https://github.com/llvm/llvm-project/pull/157059
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to