[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#151357: gcc-3.0 fails to compile virtual inheritance with variable number of argument methode



Package: gcc-3.0
Version: 1:3.0.4-7
Severity: important

When I try to compile C++ code with virtual inheritance and variable number of 
argument method, the compilation fails with the following message :

bugreport.cpp:35: generic thunk code fails for method `virtual void
   Virt::p(const char*, ...)' which uses `...'

It is working fine with gcc 2.

I have attached a very little code that shows the problem. I have also 
attached a simple makefile. To compile under woody with gcc version 2 type:
make v2
and to compile with gcc 3, type :
make v3

Thanks

Stephane

-- System Information
Debian Release: 3.0
Kernel Version: Linux nctlin.ysagoon.com 2.4.18-k7 #1 Sun Apr 14 13:19:11 EST 
2002 i686 unknown

Versions of the packages gcc-3.0 depends on:
ii  binutils       2.12.90.0.1-4  The GNU assembler, linker and binary utiliti
ii  cpp-3.0        3.0.4-7        The GNU C preprocessor.
ii  gcc-3.0-base   3.0.4-7        The GNU Compiler Collection (base package).
ii  libc6          2.2.5-6        GNU C Library: Shared libraries and Timezone
ii  libgcc1        3.1.1-0pre2    GCC support library.
#include <stdio.h>
#include <stdarg.h>

class Base
{
public:
	Base() { }
	virtual void p(const char *format, ...)=0;
};

class Der1: public virtual Base
{
public:
	Der1():Base() { }
	virtual void p(const char *format, ...)=0;
};

class Der2: public virtual Base
{
public:
	Der2():Base() { }
	virtual void p(const char *format, ...)=0;
};

class Virt:public virtual Der1, public virtual Der2
{
public:
	Virt():Der1(),Der2() { }
	virtual void p(const char *format, ...)
	{
		va_list arglist;
		va_start(arglist,format);
		vprintf(format, arglist);
		va_end(arglist);
	}
};

int main(int argc, char *argv[])
{
	Virt v;
	v.p("Hello %d\n", 10);
}
v2: bugreport.cpp
	gcc -Wall bugreport.cpp -obr
v3: bugreport.cpp
	gcc-3.0 -Wall bugreport.cpp -obr
clean:
	rm br

Reply to: