[Bug c++/49205] [C++0x] Default constructor with pack expansion parameter not detected

schaub.johannes at googlemail dot com gcc-bugzilla@gcc.gnu.org
Sat May 28 01:55:00 GMT 2011


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49205

--- Comment #2 from Johannes Schaub <schaub.johannes at googlemail dot com> 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<typename T = int> 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, ...)").



More information about the Gcc-bugs mailing list