[Bug c++/126423] New: ICE with expansion statement (that is empty) with return and no return after and auto

"pinskia at gcc dot gnu.org via Gcc-bugs" <[email protected]>
Newsgroups gmane.comp.gcc.bugs
Message-ID <[email protected]/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126423

            Bug ID: 126423
           Summary: ICE with expansion statement (that is empty) with
                    return and no return after and auto
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Keywords: c++26, ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pinskia at gcc dot gnu.org
  Target Milestone: ---

Take:
```
auto f() {
  template for (auto x : {}) {
    return x;
  }
}
```

This causes an ICE:
<source>: In function 'auto f()':
<source>:5:1: warning: control reaches end of non-void function [-Wreturn-type]
    5 | }
      | ^
during RTL pass: expand
<source>:1:6: internal compiler error: in make_decl_rtl, at varasm.cc:1487
    1 | auto f() {
      |      ^
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.