[Bug c++/49205] [C++0x] Default constructor with pack expansion parameter not detected
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49205 --- Comment #7 from Johannes Schaub 2011-06-20 15:56:42 UTC --- (In reply to comment #6) > (In reply to comment #1) > > While this behavior is erroneous, consensus at clang was that WG21 made an > > oversight in allowing this. Template constructors are banned from being > > copy or > > move constructors, and historically this prohibition was not necessary for > > default constructors since there was no special handling of them except when > > implicit. > > I disagree with this. As Johannes points out, it is possible to have a > template default constructor in C++03, so changing this would be a significant > change. We should just treat the variadic template as a default constructor. To be fair to Sean, I should note that my example relied on a C++0x feature. If we remove the template default argument: template A(T = 0); This constructor cannot really be called "with arguments" anymore (there's no deduction from default arguments), which is the condition under which a constructor becomes a default constructor.
[Bug c++/49205] [C++0x] Default constructor with pack expansion parameter not detected
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49205 Jason Merrill changed: What|Removed |Added Status|ASSIGNED|RESOLVED Resolution||FIXED Target Milestone|--- |4.7.0 --- Comment #6 from Jason Merrill 2011-06-20 14:43:23 UTC --- (In reply to comment #1) > While this behavior is erroneous, consensus at clang was that WG21 made an > oversight in allowing this. Template constructors are banned from being copy > or > move constructors, and historically this prohibition was not necessary for > default constructors since there was no special handling of them except when > implicit. I disagree with this. As Johannes points out, it is possible to have a template default constructor in C++03, so changing this would be a significant change. We should just treat the variadic template as a default constructor.
[Bug c++/49205] [C++0x] Default constructor with pack expansion parameter not detected
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49205 --- Comment #5 from Jason Merrill 2011-06-20 14:40:15 UTC --- Author: jason Date: Mon Jun 20 14:40:10 2011 New Revision: 175214 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=175214 Log: PR c++/49205 * call.c (sufficient_parms_p): Allow parameter packs too. Added: trunk/gcc/testsuite/g++.dg/cpp0x/variadic-default.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/call.c trunk/gcc/testsuite/ChangeLog
[Bug c++/49205] [C++0x] Default constructor with pack expansion parameter not detected
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49205 Jason Merrill changed: What|Removed |Added Status|UNCONFIRMED |ASSIGNED Last reconfirmed||2011.06.20 01:53:05 CC||jason at gcc dot gnu.org AssignedTo|unassigned at gcc dot |jason at gcc dot gnu.org |gnu.org | Ever Confirmed|0 |1
[Bug c++/49205] [C++0x] Default constructor with pack expansion parameter not detected
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49205 --- Comment #4 from Johannes Schaub 2011-05-28 02:06:07 UTC --- (In reply to comment #3) > I would expect that the initialization text would be amended appropriately. I > think that we should go for consistency and say non-templates only, the same > as > for copy and move constructors. Ah I see. That seems to make sense.
[Bug c++/49205] [C++0x] Default constructor with pack expansion parameter not detected
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49205 --- Comment #3 from Sean Hunt 2011-05-28 01:55:07 UTC --- I would expect that the initialization text would be amended appropriately. I think that we should go for consistency and say non-templates only, the same as for copy and move constructors.
[Bug c++/49205] [C++0x] Default constructor with pack expansion parameter not detected
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49205 --- Comment #2 from Johannes Schaub 2011-05-28 01:45:29 UTC --- (In reply to comment #1) > While this behavior is erroneous, consensus at clang was that WG21 made an > oversight in allowing this. Template constructors are banned from being copy > or > move constructors, and historically this prohibition was not necessary for > default constructors since there was no special handling of them except when > implicit. That rationale makes sense. I wonder about the implications for value initialization though. If that constructor is not a default constructor, then "A();" appears to be ill-formed, because of the saying in 8.5p7 that we shall call "the default constructor". Also, how should the rules be drawn? Is any template not a default constructor? Then what about the following? template A(T = 0); GCC appears to deem it a default constructor. Is the following rule acceptable? - A default constructor is a constructor with zero parameters or that only has parameters with default arguments and with an optional trailing ellipsis ("A(int, ...)").