[Bug c++/126420] New: Rejects valid? deducing return type with expansion statement (empty)

"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=126420

            Bug ID: 126420
           Summary: Rejects valid? deducing return type with expansion
                    statement (empty)
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Keywords: c++26, rejects-valid
          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 3;
  }
  return 1.3;
}
```

I (and others) assumed that if the expansion statement is not expanded, then
the return value is not checked,  But it seems like GCC checks it always.

Note this is forwarded from https://github.com/llvm/llvm-project/issues/212086
and clang has the same issue and there might be a core issue coming out of it.
Filing it ahead of time just in case.
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.