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

Bug#165829: GCC 3.2 C++ error on virtual function which uses ...



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Package: g++-3.2
Version: 3.2.1-0pre4
Severity: important

GCC 3.2.1 emits the following error:

foo.cc:16: generic thunk code fails for method `virtual void B::foo(char*, ...)
   ' which uses `...'

when compiling the code included below. The same code compiles & runs fine with GCC 2.95. The error also does not appear if B does not subclass from A.


#include <iostream>

class A {
public:
    virtual void foo(char* x, ...) {}
    virtual void bar(int x, ...) = 0;
};

class B   : public virtual A {
public:
    virtual void foo(char* x, ...);
    virtual void bar(int x, ...);
};

void B::foo(char* x, ...) {
    std::cout << "B::foo\n";
}

void B::bar(int x, ...) {
    std::cout << "B::bar\n";
}

int main() {
    std::cout << "hello, world\n";
    B b;
    b.foo("x", "y", "z");
    b.bar(1, 2, 3);
}


AFAIK this is completely valid C++ and there is no workaround.

I am using unstable (updated this morning) on an i686.



Thanks

reed



- --

Reed Hedges                 VOS/Interreality Project
reed@interreality.org       http://interreality.org

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (Darwin)

iD8DBQE9tKD9FK83gN8ItOQRAsjeAJ4kWn/Eg9dSO7BuScVoIS8UynM7gwCgmGGN
a3J3vrS+bES6gsbFm71BRAk=
=PLDZ
-----END PGP SIGNATURE-----




Reply to: