public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/97819] New: Pack expansion in member initializer lists nested with their parameter list got rejected.
@ 2020-11-13 19:56 gnaggnoyil at gmail dot com
2020-11-19 18:41 ` [Bug c++/97819] " mpolacek at gcc dot gnu.org
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: gnaggnoyil at gmail dot com @ 2020-11-13 19:56 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97819
Bug ID: 97819
Summary: Pack expansion in member initializer lists nested with
their parameter list got rejected.
Product: gcc
Version: 10.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: gnaggnoyil at gmail dot com
Target Milestone: ---
The following code got accepted by Clang 10.0 and MSVC 19.27.29112, yet fails
to compile under GCC:
template <class ...Ts>
class foo : public Ts...{
public:
template <typename T, typename ...Us>
explicit foo(T &&t, Us &&...us)
//: Ts(Ts(t, us))...{} -> This line is accepted
//: Ts{t, us...}...{} -> This line is accepted too
: Ts(t, us...)...{} // This line is rejected
};
class bar{
public:
explicit bar(int){}
};
class qux{
public:
explicit qux(int){}
};
class baz{
public:
explicit baz(int){}
};
int main(){
foo<bar, baz, qux> x(3);
(void)x;
return 0;
}
I tried GCC version 4.9.3 with -std=c++14, 5.5.0, 6.3.0, 7.3.0 with -std=c++17,
and 8.3.0, 9.3.0, 10.1.0 with -std=c++2a, all of them rejects this code.
Error outputs for GCC 4.9.3, 5.5.0, 9.3.0, 10.1.0 ones are:
prog.cc: In instantiation of 'foo<Ts>::foo(T&&, Us&& ...) [with T = int; Us =
{}; Ts = bar, baz, qux]':
prog.cc:27:27: required from here
prog.cc:8:23: error: invalid use of pack expansion expression
: Ts(t, us...)...{}
^
Error outputs for GCC 6.3.0, 7.3.0, 8.3.0 ones are:
prog.cc: In instantiation of 'foo<Ts>::foo(T&&, Us&& ...) [with T = int; Us =
{}; Ts = {bar, baz, qux}]':
prog.cc:27:27: required from here
prog.cc:8:23: error: no matching function for call to 'bar::bar(int&, bool)'
: Ts(t, us...)...{}
^~~
prog.cc:13:14: note: candidate: bar::bar(int)
explicit bar(int){}
^~~
prog.cc:13:14: note: candidate expects 1 argument, 2 provided
prog.cc:11:7: note: candidate: constexpr bar::bar(const bar&)
class bar{
^~~
prog.cc:11:7: note: candidate expects 1 argument, 2 provided
prog.cc:11:7: note: candidate: constexpr bar::bar(bar&&)
prog.cc:11:7: note: candidate expects 1 argument, 2 provided
prog.cc:8:23: error: no matching function for call to 'baz::baz(int&, bool)'
: Ts(t, us...)...{}
^~~
prog.cc:23:14: note: candidate: baz::baz(int)
explicit baz(int){}
^~~
prog.cc:23:14: note: candidate expects 1 argument, 2 provided
prog.cc:21:7: note: candidate: constexpr baz::baz(const baz&)
class baz{
^~~
prog.cc:21:7: note: candidate expects 1 argument, 2 provided
prog.cc:21:7: note: candidate: constexpr baz::baz(baz&&)
prog.cc:21:7: note: candidate expects 1 argument, 2 provided
prog.cc:8:23: error: no matching function for call to 'qux::qux(int&, bool)'
: Ts(t, us...)...{}
^~~
prog.cc:18:14: note: candidate: qux::qux(int)
explicit qux(int){}
^~~
prog.cc:18:14: note: candidate expects 1 argument, 2 provided
prog.cc:16:7: note: candidate: constexpr qux::qux(const qux&)
class qux{
^~~
prog.cc:16:7: note: candidate expects 1 argument, 2 provided
prog.cc:16:7: note: candidate: constexpr qux::qux(qux&&)
prog.cc:16:7: note: candidate expects 1 argument, 2 provided
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/97819] Pack expansion in member initializer lists nested with their parameter list got rejected.
2020-11-13 19:56 [Bug c++/97819] New: Pack expansion in member initializer lists nested with their parameter list got rejected gnaggnoyil at gmail dot com
@ 2020-11-19 18:41 ` mpolacek at gcc dot gnu.org
2021-08-05 1:00 ` pinskia at gcc dot gnu.org
2021-12-08 14:30 ` marxin at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2020-11-19 18:41 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97819
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever confirmed|0 |1
CC| |mpolacek at gcc dot gnu.org
Last reconfirmed| |2020-11-19
--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Shorter test:
template <typename... T> struct S : T... {
template <typename U, typename... V> S(U u, V... v) : T(u, v...)... {}
};
struct R {
R(int);
};
void h() { S<R>(3); }
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/97819] Pack expansion in member initializer lists nested with their parameter list got rejected.
2020-11-13 19:56 [Bug c++/97819] New: Pack expansion in member initializer lists nested with their parameter list got rejected gnaggnoyil at gmail dot com
2020-11-19 18:41 ` [Bug c++/97819] " mpolacek at gcc dot gnu.org
@ 2021-08-05 1:00 ` pinskia at gcc dot gnu.org
2021-12-08 14:30 ` marxin at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-05 1:00 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97819
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
See Also| |https://gcc.gnu.org/bugzill
| |a/show_bug.cgi?id=65422
Known to fail| |11.1.0
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
This looks fixed on the trunk
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/97819] Pack expansion in member initializer lists nested with their parameter list got rejected.
2020-11-13 19:56 [Bug c++/97819] New: Pack expansion in member initializer lists nested with their parameter list got rejected gnaggnoyil at gmail dot com
2020-11-19 18:41 ` [Bug c++/97819] " mpolacek at gcc dot gnu.org
2021-08-05 1:00 ` pinskia at gcc dot gnu.org
@ 2021-12-08 14:30 ` marxin at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-12-08 14:30 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97819
Martin Liška <marxin at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
See Also| |https://gcc.gnu.org/bugzill
| |a/show_bug.cgi?id=88580
Status|NEW |RESOLVED
Resolution|--- |FIXED
CC| |marxin at gcc dot gnu.org
--- Comment #3 from Martin Liška <marxin at gcc dot gnu.org> ---
Fixed in r12-174-g37d2b98100cefcb9.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-12-08 14:30 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-13 19:56 [Bug c++/97819] New: Pack expansion in member initializer lists nested with their parameter list got rejected gnaggnoyil at gmail dot com
2020-11-19 18:41 ` [Bug c++/97819] " mpolacek at gcc dot gnu.org
2021-08-05 1:00 ` pinskia at gcc dot gnu.org
2021-12-08 14:30 ` marxin 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).