gcc 3.2.1 error when invoking __va_copy with const argument

From: Sriram (sriramkumar_at_yahoo.com)
Date: 08/26/03


Date: 26 Aug 2003 00:35:16 -0700

Hello folks,

I have run into a gcc 3.2.1 error with __va_copy on the PPC
architecture. I realize that va_list is defined differently on PPC;
this code used to work with gcc 2.95.3 but it doesn't anymore.

Here's my test program, valist.c:

#include <varargs.h>

class A
{
public:
    A(){}
    A(const A&rhs)
    {
        __va_copy(ap, rhs.ap);
    }
private:
    va_list ap;
};

int main(int argc, char *argv[])
{
    return 0;
}

The error is:

valist.c: In copy constructor `A::A(const A&)':
valist.c:9: invalid conversion from `const __va_list_tag*' to
`__va_list_tag*'

Is the above usage of va_list incorrect? Does it not make sense to
apply the const qualifier to the type va_list?

An explanation is greatly appreciated.

Thanks,
Sriram


Quantcast