public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/108948] New: <unresolved overloaded function type> for function template with auto return and parameter pack
@ 2023-02-27 12:09 egpt.gcc at wolke7 dot net
  2023-02-27 12:34 ` [Bug c++/108948] " redi at gcc dot gnu.org
  2023-02-27 12:35 ` redi at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: egpt.gcc at wolke7 dot net @ 2023-02-27 12:09 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 108948
           Summary: <unresolved overloaded function type> for function
                    template with auto return and parameter pack
           Product: gcc
           Version: 12.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: egpt.gcc at wolke7 dot net
  Target Milestone: ---

Hello,

consider the following code (with -std=c++17):
------------------------------------------------------------------
#include <tuple>

template <typename... Types>
auto add1(const Types... x) { return std::make_tuple((x+1)...); }

int main() {
  auto x = std::apply(add1<int,int>, std::make_tuple(10,20));
  return 0;
}
------------------------------------------------------------------

Compiling with g++ 12.2.0 (Debian testing) yields the following error message:
------------------------------------------------------------------
add1.cpp: In function 'int main()':
add1.cpp:11:29: error: invalid initialization of non-const reference of type
'std::tuple<int, int> (&)(int, int)' from an rvalue of type '<unresolved
overloaded function type>'
   11 |         auto x = std::apply(add1<int,int>, t);
      |                             ^~~~~~~~~~~~~
------------------------------------------------------------------

Both, clang++ 14.0.6 (Debian testing) and icpx 2023.0.0 compile just fine. It
seems related to the resolved bug 64194. It works with add1 being defined
without parameter pack as follows:
------------------------------------------------------------------
template <typename Type1, typename Type2>
auto add1(const Type1 x, const Type2 y) { return std::make_tuple(x+1,y+1); }
------------------------------------------------------------------

Kind regards
Elmar

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

* [Bug c++/108948] <unresolved overloaded function type> for function template with auto return and parameter pack
  2023-02-27 12:09 [Bug c++/108948] New: <unresolved overloaded function type> for function template with auto return and parameter pack egpt.gcc at wolke7 dot net
@ 2023-02-27 12:34 ` redi at gcc dot gnu.org
  2023-02-27 12:35 ` redi at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: redi at gcc dot gnu.org @ 2023-02-27 12:34 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=56190

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
It has nothing to do with the auto return (and so probably nothing to do with
64194).

Reduced:

template<typename... T> struct tuple { };

template<typename F, typename Tuple> auto apply(F&&, Tuple&&) { }

template <typename... Types> void add1(const Types...) { }

int main() {
  apply(add1<int,int>, tuple<int, int>());
}

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

* [Bug c++/108948] <unresolved overloaded function type> for function template with auto return and parameter pack
  2023-02-27 12:09 [Bug c++/108948] New: <unresolved overloaded function type> for function template with auto return and parameter pack egpt.gcc at wolke7 dot net
  2023-02-27 12:34 ` [Bug c++/108948] " redi at gcc dot gnu.org
@ 2023-02-27 12:35 ` redi at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: redi at gcc dot gnu.org @ 2023-02-27 12:35 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
           Keywords|                            |rejects-valid
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2023-02-27

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

end of thread, other threads:[~2023-02-27 12:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-27 12:09 [Bug c++/108948] New: <unresolved overloaded function type> for function template with auto return and parameter pack egpt.gcc at wolke7 dot net
2023-02-27 12:34 ` [Bug c++/108948] " redi at gcc dot gnu.org
2023-02-27 12:35 ` redi 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).