This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: gcc 2.95.2 problem
- To: Piotr Nestorow <Piotr dot Nestorow at telelogic dot se>
- Subject: Re: gcc 2.95.2 problem
- From: Brian Beuning <bbeuning at mindspring dot com>
- Date: Wed, 08 Dec 1999 06:10:49 -0500
- CC: gcc at gcc dot gnu dot org
- References: <m11vgIh-00005QC@blue.telelogic.se>
Is it legal to have a default value in a definition?
int ff (const C &a, fp predicate = C::f) { .. }
Maybe you could try it like this instead?
extern int ff (const C &a, fp predicate = C::f);
int ff (const C &a, fp predicate ) { .. }
Brian Beuning
Piotr Nestorow wrote:
> Hi,
>
> On Linux (RedHat 6.1) with g++:
>
> Reading specs from /usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95.2/specs
> gcc version 2.95.2 19991024 (release)
>
> I get a strange error:
>
> t.cc:10: sorry, not implemented: initializer contains unrecognized tree code
> t.cc:10: default argument `C::f' uses local variable ` /* decl error */ '
>
> How can this be fixed? In the code, in the compiler ...
>
> Regards
> Piotr Nestorow
> Telelogic AB, Sweden
> Piotr.Nestorow@telelogic.se
>
> The example t.cc:
> -----------------
>
> typedef bool (*fp)(wchar_t);
>
> class C {
> public:
> static bool f(wchar_t);
> static bool f(char c);
> };
>
> int ff (const C &a, fp predicate = C::f)
> {
> return 2;
> }
>
> bool C::f(wchar_t)
> {
> return 1;
> }
>
> int main(void) {
> C c;
> ff(c);
> return 0;
> }