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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mpolacek at gcc dot gnu.org

--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
We catch that problem if the initializer is actually used:

```
struct A{ int t; };

template<typename T>
struct B{
  A &a{ 4 }; // this is wrong
};

int main(){
    B<double> b2{};
}
```

115557-2.C:5:6: error: cannot bind non-const lvalue reference of type ‘A&’ to
an rvalue of type ‘A’
    5 |   A &a{ 4 }; // this is wrong

Reply via email to