public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/95010] New: Recursive function template with function parameter of type decltype([]{})  is rejected
@ 2020-05-08 14:39 ppalka at gcc dot gnu.org
  2023-01-19  6:35 ` [Bug c++/95010] " pinskia at gcc dot gnu.org
  2024-04-13  7:38 ` pinskia at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: ppalka at gcc dot gnu.org @ 2020-05-08 14:39 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 95010
           Summary: Recursive function template with function parameter of
                    type decltype([]{})  is rejected
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ppalka at gcc dot gnu.org
  Target Milestone: ---

$ cat testcase.C
template<typename T>
void foo(decltype([]{}) *s) {
  if (0)
    foo<T>(s);
}

void bar() {
  foo<int>(nullptr);
}

$ g++ -std=c++2a testcase.C
testcase.C: In instantiation of ‘void foo(decltype (<lambda>)*) [with T = int;
decltype (<lambda>) = foo<int>::<lambda()>]’:
testcase.C:8:19:   required from here
testcase.C:4:12: error: cannot convert ‘<lambda()>*’ to ‘<lambda()>*’
    4 |     foo<T>(s);
      |            ^
      |            |
      |            <lambda()>*
testcase.C:2:26: note:   initializing argument 1 of ‘void foo(decltype
(<lambda>)*) [with T = int; decltype (<lambda>) = foo<int>::<lambda()>]’
    2 | void foo(decltype([]{}) *s) {
      |          ~~~~~~~~~~~~~~~~^


We should also accept:

template<typename T>
void foo(decltype([]{}) *s, decltype(s) q) {
  foo<T>(q, s);
}

void bar() {
  foo<int>(nullptr, nullptr);
}

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

* [Bug c++/95010] Recursive function template with function parameter of type decltype([]{})  is rejected
  2020-05-08 14:39 [Bug c++/95010] New: Recursive function template with function parameter of type decltype([]{}) is rejected ppalka at gcc dot gnu.org
@ 2023-01-19  6:35 ` pinskia at gcc dot gnu.org
  2024-04-13  7:38 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-01-19  6:35 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2023-01-19
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed.

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

* [Bug c++/95010] Recursive function template with function parameter of type decltype([]{})  is rejected
  2020-05-08 14:39 [Bug c++/95010] New: Recursive function template with function parameter of type decltype([]{}) is rejected ppalka at gcc dot gnu.org
  2023-01-19  6:35 ` [Bug c++/95010] " pinskia at gcc dot gnu.org
@ 2024-04-13  7:38 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-04-13  7:38 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Hmm, EDG, clang and MSVC (and GCC) all reject both testcases with the very
similar error message.

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

end of thread, other threads:[~2024-04-13  7:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-08 14:39 [Bug c++/95010] New: Recursive function template with function parameter of type decltype([]{}) is rejected ppalka at gcc dot gnu.org
2023-01-19  6:35 ` [Bug c++/95010] " pinskia at gcc dot gnu.org
2024-04-13  7:38 ` 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).