https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53637

trashyankes at wp dot pl changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |trashyankes at wp dot pl

--- Comment #9 from trashyankes at wp dot pl ---
I see that GCC can fail even on single variable:

https://godbolt.org/z/En6FEs
```
//gcc 9.1
#include <iostream>

struct A{
    int val;
    A(int val_):val(val_){}
    A(const A&o):val(o.val){
        std::cout<<"copying: "<<val<<"\n";
    }
};

A create()
{
    {
        A s(21);
        return s;
    }
}

int main(){
    create();
}

```


It will print `copying: 21`

When I remove addition curve braces then GCC create correct RVO.

Clang correctly handle both cases.

Reply via email to