public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/113141] New: ICE on conversion to reference in aggregate initialization
@ 2023-12-26  1:36 de34 at live dot cn
  2023-12-26  5:12 ` [Bug c++/113141] " pinskia at gcc dot gnu.org
                   ` (12 more replies)
  0 siblings, 13 replies; 14+ messages in thread
From: de34 at live dot cn @ 2023-12-26  1:36 UTC (permalink / raw)
  To: gcc-bugs

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.

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2024-05-01 22:19 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-26  1:36 [Bug c++/113141] New: ICE on conversion to reference in aggregate initialization de34 at live dot cn
2023-12-26  5:12 ` [Bug c++/113141] " pinskia at gcc dot gnu.org
2023-12-26  5:14 ` [Bug c++/113141] [13/14 Regression] " pinskia at gcc dot gnu.org
2024-01-02 18:25 ` ppalka at gcc dot gnu.org
2024-01-24  7:48 ` slyfox at gcc dot gnu.org
2024-01-24 15:47 ` ppalka at gcc dot gnu.org
2024-03-07 20:53 ` law at gcc dot gnu.org
2024-03-12 13:21 ` jakub at gcc dot gnu.org
2024-03-14 18:27 ` pinskia at gcc dot gnu.org
2024-03-21  9:07 ` pinskia at gcc dot gnu.org
2024-04-12 20:14 ` ppalka at gcc dot gnu.org
2024-04-12 20:15 ` ppalka at gcc dot gnu.org
2024-05-01 22:16 ` [Bug c++/113141] [13 " cvs-commit at gcc dot gnu.org
2024-05-01 22:19 ` ppalka at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).