https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113141
Bug ID: 113141
Summary: ICE on conversion to reference in aggregate
initialization
Product: gcc
Version: 13.2.1
Status: UNCONFIRMED
Keywords: ice-checking, ice-on-invalid-code
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: de34 at live dot cn
Target Milestone: ---
The following program triggers ICE since GCC 13
(https://godbolt.org/z/PaqWsG9s6):
```
int global_x{};
struct ConvToRef {
operator int&() { return global_x; }
};
struct Foo { int& r; };
int main()
{
Foo bar{ { ConvToRef{} } };
}
```
Clang considers this ill-formed and emits "non-const lvalue reference to type
'int' cannot bind to an initializer list temporary".
If the type of r is changed to const int&, the program correctly compiles with
GCC.