public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/96095] New: decltype((r)) inside of lambda with copy capture gives wrong type
@ 2020-07-07 15:06 barry.revzin at gmail dot com
  2020-07-07 15:35 ` [Bug c++/96095] " mpolacek at gcc dot gnu.org
  2021-12-03  9:42 ` pinskia at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: barry.revzin at gmail dot com @ 2020-07-07 15:06 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 96095
           Summary: decltype((r)) inside of lambda with copy capture gives
                    wrong type
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: barry.revzin at gmail dot com
  Target Milestone: ---

Couldn't find a dupe for this one. The example from what is now
[expr.prim.id.unqual]/2 (http://eel.is/c++draft/expr.prim.id.unqual#2) doesn't
have the expected behavior:

template <typename T, typename U>
inline constexpr bool is_same_v = false;

template <typename T>
inline constexpr bool is_same_v<T, T> = true;

void f(float x, float& r) {
    [=] {
        static_assert(is_same_v<decltype(x), float>);
        static_assert(is_same_v<decltype((x)), float const&>);
        static_assert(is_same_v<decltype(r), float&>);
        static_assert(is_same_v<decltype((r)), float const&>); // error
    }();
}

gcc reports decltype((r)) to be float&, not float const& here.

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

* [Bug c++/96095] decltype((r)) inside of lambda with copy capture gives wrong type
  2020-07-07 15:06 [Bug c++/96095] New: decltype((r)) inside of lambda with copy capture gives wrong type barry.revzin at gmail dot com
@ 2020-07-07 15:35 ` mpolacek at gcc dot gnu.org
  2021-12-03  9:42 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2020-07-07 15:35 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mpolacek at gcc dot gnu.org
           Keywords|                            |rejects-valid
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2020-07-07
     Ever confirmed|0                           |1

--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Confirmed.

The [expr.prim.id.unqual]/2 example comes from P0588R1 Simplifying implicit
lambda capture.

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

* [Bug c++/96095] decltype((r)) inside of lambda with copy capture gives wrong type
  2020-07-07 15:06 [Bug c++/96095] New: decltype((r)) inside of lambda with copy capture gives wrong type barry.revzin at gmail dot com
  2020-07-07 15:35 ` [Bug c++/96095] " mpolacek at gcc dot gnu.org
@ 2021-12-03  9:42 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-12-03  9:42 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |DUPLICATE
             Status|NEW                         |RESOLVED

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Dup of bug 79620.

*** This bug has been marked as a duplicate of bug 79620 ***

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

end of thread, other threads:[~2021-12-03  9:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-07 15:06 [Bug c++/96095] New: decltype((r)) inside of lambda with copy capture gives wrong type barry.revzin at gmail dot com
2020-07-07 15:35 ` [Bug c++/96095] " mpolacek at gcc dot gnu.org
2021-12-03  9:42 ` pinskia 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).