public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "nickhuang99 at hotmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/104358] Assignable template lambda as function parameter is incorrectly reduced to type of "int"
Date: Thu, 03 Feb 2022 20:14:11 +0000	[thread overview]
Message-ID: <bug-104358-4-TxSGOS9pYV@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-104358-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #1 from qingzhe huang <nickhuang99 at hotmail dot com> ---
Sorry about the long description and here is the short version to highlight the
core issue. Given this template function with a templated lambda as parameter:

template<typename T>
using Lambda=decltype(+[](T){});

template<typename T>
auto foo(T&&, Lambda<T>)->T;



GCC considers the parameter "Lambda<T>" as type "int" which is wrong:

static_assert(is_same_v<decltype(&foo<int>), 
                 int(*)(int&&, /*"Lambda<T>"*/ int)>);

  reply	other threads:[~2022-02-03 20:14 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-03  1:24 [Bug c++/104358] New: " nickhuang99 at hotmail dot com
2022-02-03 20:14 ` nickhuang99 at hotmail dot com [this message]
2022-02-05 22:46 ` [Bug c++/104358] " nickhuang99 at hotmail dot com
2022-10-27  5:21 ` [Bug c++/104358] signature of template function with template lambda(converted to function pointer) mistakenly regards it as " pinskia at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-104358-4-TxSGOS9pYV@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).