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

* [Bug c++/115504] [14/15 Regression] Wrong decltype result for a captured reference inside lambda
  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 ` pinskia at gcc dot gnu.org
  2024-06-17  5:52 ` rguenth at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-06-15 19:00 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
I suspect the fix for PR 96917 broke references (or rather changed all to be
non references).

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

* [Bug c++/115504] [14/15 Regression] Wrong decltype result for a captured reference inside lambda
  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
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2024-06-17  5:52 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |14.2

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

* [Bug c++/115504] [14/15 Regression] Wrong decltype result for a captured reference inside lambda
  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
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2024-06-17 11:15 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
           Keywords|needs-bisection             |
           Priority|P3                          |P2
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2024-06-17
                 CC|                            |jakub at gcc dot gnu.org,
                   |                            |ppalka at gcc dot gnu.org

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Started with r14-5330-g705ab7927c81b77503d229513fac991106617766

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

* [Bug c++/115504] [14/15 Regression] Wrong decltype result for a captured reference inside lambda since r14-5330
  2024-06-15 12:55 [Bug c++/115504] New: Wrong decltype result for a captured reference inside limbda fchelnokov at gmail dot com
                   ` (2 preceding siblings ...)
  2024-06-17 11:15 ` jakub at gcc dot gnu.org
@ 2024-06-18 17:23 ` ppalka at gcc dot gnu.org
  2024-06-26  0:07 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: ppalka at gcc dot gnu.org @ 2024-06-18 17:23 UTC (permalink / raw)
  To: gcc-bugs

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

Patrick Palka <ppalka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |ppalka at gcc dot gnu.org

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

* [Bug c++/115504] [14/15 Regression] Wrong decltype result for a captured reference inside lambda since r14-5330
  2024-06-15 12:55 [Bug c++/115504] New: Wrong decltype result for a captured reference inside limbda fchelnokov at gmail dot com
                   ` (3 preceding siblings ...)
  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
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-06-26  0:07 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Patrick Palka <ppalka@gcc.gnu.org>:

https://gcc.gnu.org/g:737449e5f233feb682b5dd2cc153892ad90a79bd

commit r15-1631-g737449e5f233feb682b5dd2cc153892ad90a79bd
Author: Patrick Palka <ppalka@redhat.com>
Date:   Tue Jun 25 20:07:15 2024 -0400

    c++: decltype of capture proxy of ref [PR115504]

    The finish_decltype_type capture proxy handling added in r14-5330 was
    incorrectly stripping references in the type of the captured variable.

            PR c++/115504

    gcc/cp/ChangeLog:

            * semantics.cc (finish_decltype_type): Don't strip the reference
            type (if any) of a capture proxy's captured variable.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp1y/decltype-auto8.C: New test.

    Reviewed-by: Jason Merrill <jason@redhat.com>

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

* [Bug c++/115504] [14/15 Regression] Wrong decltype result for a captured reference inside lambda since r14-5330
  2024-06-15 12:55 [Bug c++/115504] New: Wrong decltype result for a captured reference inside limbda fchelnokov at gmail dot com
                   ` (4 preceding siblings ...)
  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
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-06-28 21:14 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-14 branch has been updated by Patrick Palka
<ppalka@gcc.gnu.org>:

https://gcc.gnu.org/g:e6b115be1c392de415925282a38f28cd78cb6c35

commit r14-10359-ge6b115be1c392de415925282a38f28cd78cb6c35
Author: Patrick Palka <ppalka@redhat.com>
Date:   Tue Jun 25 20:07:15 2024 -0400

    c++: decltype of capture proxy of ref [PR115504]

    The finish_decltype_type capture proxy handling added in r14-5330 was
    incorrectly stripping references in the type of the captured variable.

            PR c++/115504

    gcc/cp/ChangeLog:

            * semantics.cc (finish_decltype_type): Don't strip the reference
            type (if any) of a capture proxy's captured variable.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp1y/decltype-auto8.C: New test.

    Reviewed-by: Jason Merrill <jason@redhat.com>
    (cherry picked from commit 737449e5f233feb682b5dd2cc153892ad90a79bd)

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

* [Bug c++/115504] [14/15 Regression] Wrong decltype result for a captured reference inside lambda since r14-5330
  2024-06-15 12:55 [Bug c++/115504] New: Wrong decltype result for a captured reference inside limbda fchelnokov at gmail dot com
                   ` (5 preceding siblings ...)
  2024-06-28 21:14 ` cvs-commit at gcc dot gnu.org
@ 2024-06-28 21:17 ` ppalka at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: ppalka at gcc dot gnu.org @ 2024-06-28 21:17 UTC (permalink / raw)
  To: gcc-bugs

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

Patrick Palka <ppalka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|ASSIGNED                    |RESOLVED

--- Comment #5 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Fixed for GCC 14.2, thanks for the bug report.

^ 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).