[Bug c++/14454] New: virtual function with variable number of arguments won't compile

ktrummel at scene7 dot com gcc-bugzilla@gcc.gnu.org
Sat Mar 6 02:05:00 GMT 2004


This problem occurs on g++ version 3.3.2 on Solaris 8.  Here is the output from 
g++ -v:

Reading specs from /usr/local/lib/gcc-lib/sparc-sun-solaris2.8/3.3.2/specs
Configured with: ../configure --with-as=/usr/ccs/bin/as --with-
ld=/usr/ccs/bin/ld --disable-nls
Thread model: posix
gcc version 3.3.2

The strange thing is that this does NOT occur with g++ 3.3.2 on Linux.  Here is 
the output from g++ -v for it:

Reading specs from /usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.3.2/specs
Configured with: ../gcc-3.3.2/configure 
Thread model: posix
gcc version 3.3.2

Take the source appended to this message and simply compile (i.e. "g++ -c 
virtual.cpp") and the output is the following:

virtual.cpp:23: error: generic thunk code fails for method `virtual void 
   Foo::log(int, const char*, ...)' which uses `...'


And here is the source:

#include <stdarg.h>
#include <stdio.h>

class BaseClass
{
public:
    BaseClass() {}
    virtual ~BaseClass() {}
    virtual void log(int level, const char *format, ...);
};

class Foo : public virtual BaseClass
{
public:
    Foo() {}
    virtual ~Foo() {}
    virtual void log(int level, const char *format, ...);
private:
};

void Foo::log(int level, const char *format, ...)
{
}

-- 
           Summary: virtual function with variable number of arguments won't
                    compile
           Product: gcc
           Version: 3.3.2
            Status: UNCONFIRMED
          Severity: critical
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: ktrummel at scene7 dot com
                CC: gcc-bugs at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14454



More information about the Gcc-bugs mailing list