Bug#204580: g++: unexpected output using variadic functions in classes
"Frank B. Brokken" <f.b.brokken@rc.rug.nl> writes:
> class Foo
> {
> va_list list;
>
> public:
> Foo(int n, ...)
> {
> va_start(list, n);
> }
> void bar() const
> {
> va_list l(list);
> cout << "Saw " << va_arg(l, int) << endl;
> }
> };
The behavour of this code is undefined, since ther is no va_end
matching the va_start. Please try to provide an example without
undefined behaviour. You probably need va_copy.
--
Falk
Reply to: