c++/7703: [2003-01-28] gcc gives parse errors when compiling a class function with recursively templated default value for a function parameter

Giovanni Bajo giovannibajo@libero.it
Fri May 2 01:19:00 GMT 2003


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

This is only about the comma in the default parameter:

-----------------------------
template <class, class>
struct Bar
{};

template <class>
struct Foo
{
    void func(Bar<void, void> b = Bar<void, void>())
    {
    }
};

template struct Foo<void>;
-----------------------------
pr7703.cpp:8: error: variable or field `func' declared void
pr7703.cpp:8: error: expected function-definition

I'm confident this is a duplicate but I could not find the other PR.
The obvious workaround is just to put a couple of parenthesis around the
default parameter to disambiguate the parser (which is confused by the
comma).

Since this is one of the points discussed in DR325, I suspend this PR till
the resolution of the defect report.

Giovanni Bajo



More information about the Gcc-bugs mailing list