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

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