This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: c++/10111: Parse error for default template parameter


http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&p
r=10111

Not a real bug. All boils down to a definition like this:

void Foo(int a = A<int,int>::something) {}

There is an open defect report about this
(http://www.comeaucomputing.com/iso/cwg_active.html#325), because (shortly)
ISO C++ does not mandate that the compiler must understand that the comma is
separating template parameters, and not parameters of the function you are
declaring. Simple workaround is putting a couple of paranthesis around the
default argument, the code will compile correctly:

void Foo(int a = (A<int,int>::something)) {}

Notice that both Comeau and VC7.1 accepts this syntax right now, maybe it
could be worth considering adding it as an "extension" to the mainline. I
think it's common sense that the code should work.

(Another little note is that the code, as submitted, is ill-formed, typename
may not be used outside template definitions).

Giovanni Bajo


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]