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

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