public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/115504] New: Wrong decltype result for a captured reference inside limbda
@ 2024-06-15 12:55 fchelnokov at gmail dot com
  2024-06-15 19:00 ` [Bug c++/115504] [14/15 Regression] Wrong decltype result for a captured reference inside lambda pinskia at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: fchelnokov at gmail dot com @ 2024-06-15 12:55 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 115504
           Summary: Wrong decltype result for a captured reference inside
                    limbda
           Product: gcc
           Version: 14.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: fchelnokov at gmail dot com
  Target Milestone: ---

This program
```
template<class T> int foo() = delete;
template<> int foo<int&>() { return 0; }

int main() { 
    int y = 0;
    int &i = y;
    return [&i]() {
        decltype(auto) x = i;
        return foo<decltype(x)>();
    }();
}
```
is accepted in Clang, MSVC and GCC 13.3, but not in GCC 14, which thinks that
`decltype(x)=int`. Online demo: https://gcc.godbolt.org/z/fc1nrP4P9

Related discussion: https://stackoverflow.com/a/78626163/7325599

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

end of thread, other threads:[~2024-06-28 21:17 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-15 12:55 [Bug c++/115504] New: Wrong decltype result for a captured reference inside limbda fchelnokov at gmail dot com
2024-06-15 19:00 ` [Bug c++/115504] [14/15 Regression] Wrong decltype result for a captured reference inside lambda pinskia at gcc dot gnu.org
2024-06-17  5:52 ` rguenth at gcc dot gnu.org
2024-06-17 11:15 ` jakub at gcc dot gnu.org
2024-06-18 17:23 ` [Bug c++/115504] [14/15 Regression] Wrong decltype result for a captured reference inside lambda since r14-5330 ppalka at gcc dot gnu.org
2024-06-26  0:07 ` cvs-commit at gcc dot gnu.org
2024-06-28 21:14 ` cvs-commit at gcc dot gnu.org
2024-06-28 21:17 ` 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).