public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/67332] New: [C++11] g++ rejects expansion of multiple parameter packs
@ 2015-08-24  1:28 miyuki at gcc dot gnu.org
  2021-07-31 21:21 ` [Bug c++/67332] " pinskia at gcc dot gnu.org
  2021-08-23  9:00 ` pinskia at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: miyuki at gcc dot gnu.org @ 2015-08-24  1:28 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 67332
           Summary: [C++11] g++ rejects expansion of multiple parameter
                    packs
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: miyuki at gcc dot gnu.org
  Target Milestone: ---

Consider the following code:

$ cat test2.cc
template<typename... Args>
struct Typelist { };

template<typename... InvokableArgs, typename... Rest>
void foo (Typelist<InvokableArgs...>, Typelist<Rest...>, InvokableArgs&&...,
Rest&&...) { }

void bar()
{
    foo (Typelist<double>(), Typelist<int>(), 2.5, 1);
}

GCC 6 rejects it:
$ g++ -c test2.cc
test2.cc: In function 'void bar()':
test2.cc:9:53: error: no matching function for call to 'foo(Typelist<double>,
Typelist<int>, double, int)'
     foo (Typelist<double>(), Typelist<int>(), 2.5, 1);
                                                     ^
test2.cc:5:6: note: candidate: template<class ... InvokableArgs, class ...
Rest> void foo(Typelist<InvokableArgs ...>, Typelist<Rest ...>, InvokableArgs&&
..., Rest&& ...)
 void foo (Typelist<InvokableArgs...>, Typelist<Rest...>, InvokableArgs&&...,
Rest&&...) { }
      ^
test2.cc:5:6: note:   template argument deduction/substitution failed:
test2.cc:9:53: note:   inconsistent parameter pack deduction with '' and ''
     foo (Typelist<double>(), Typelist<int>(), 2.5, 1);

Clang 3.7 accepts the code, but EDG also rejects:
$ /opt/intel/bin/icpc -std=c++11 -c test2.cc
test2.cc(9): error: no instance of function template "foo" matches the argument
list
            argument types are: (Typelist<double>, Typelist<int>, double, int)
      foo (Typelist<double>(), Typelist<int>(), 2.5, 1);
      ^

compilation aborted for test2.cc (code 2)

Although I'm not sure, whether the code is valid or not, at least the
diagnostic is somewhat confusing.


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

* [Bug c++/67332] [C++11] g++ rejects expansion of multiple parameter packs
  2015-08-24  1:28 [Bug c++/67332] New: [C++11] g++ rejects expansion of multiple parameter packs miyuki at gcc dot gnu.org
@ 2021-07-31 21:21 ` pinskia at gcc dot gnu.org
  2021-08-23  9:00 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-07-31 21:21 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
clang rejects it:
<source>:9:5: error: no matching function for call to 'foo'
    foo (Typelist<double>(), Typelist<int>(), 2.5, 1);
    ^~~
<source>:5:6: note: candidate template ignored: deduced packs of different
lengths for parameter 'InvokableArgs' (<double> vs. <>)
void foo (Typelist<InvokableArgs...>, Typelist<Rest...>, InvokableArgs&&...,
Rest&&...) { }
     ^

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

* [Bug c++/67332] [C++11] g++ rejects expansion of multiple parameter packs
  2015-08-24  1:28 [Bug c++/67332] New: [C++11] g++ rejects expansion of multiple parameter packs miyuki at gcc dot gnu.org
  2021-07-31 21:21 ` [Bug c++/67332] " pinskia at gcc dot gnu.org
@ 2021-08-23  9:00 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-23  9:00 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Depends on|                            |83542

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
I think this is a dup of bug 83542.


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83542
[Bug 83542] template deduction failure when using pack in both deduced and
non-deduced contexts

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

end of thread, other threads:[~2021-08-23  9:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-24  1:28 [Bug c++/67332] New: [C++11] g++ rejects expansion of multiple parameter packs miyuki at gcc dot gnu.org
2021-07-31 21:21 ` [Bug c++/67332] " pinskia at gcc dot gnu.org
2021-08-23  9:00 ` 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).