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

            Bug ID: 106489
           Summary: Valid Code involving assignment rejected by gcc
           Product: gcc
           Version: 11.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jlame646 at gmail dot com
  Target Milestone: ---

The following valid code is rejected by gcc. https://godbolt.org/z/z9MKfz3e8

```
class A{
// implicitly generated assignment operations
};

int main() {
// ... 
A& a = A{} = A{};
}
```
Error says:

```
<source>:7:12: error: cannot bind non-const lvalue reference of type 'A&' to an
rvalue of type 'A'
    7 | A& a = A{} = A{};
      |        ~~~~^~~~~
```

Reply via email to