This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Passing class objects through ... with egcs (g++)
- To: "Douglas E. Sprague" <dsprague at btv dot ibm dot com>
- Subject: Re: Passing class objects through ... with egcs (g++)
- From: Doug Semler <doug at seaspace dot com>
- Date: Wed, 31 Mar 1999 12:17:03 -0800
- cc: egcs at egcs dot cygnus dot com
> Hi,
>
> I'm porting an application from AIX/xlC to Linux/g++.
>
> I'm using egcs-1.0.2 and am having problems compiling some functions
> which allow class objects to be passed as variable # of arguments (...).
>
> I get the following compile warning:
>
> warning: cannot pass objects of type `XXX' through `...'
>
> where XXX is my class type.
>
> Is this something that is allowed in a newer version of egcs or is there
> some command line option I can specify to allow this to work?
>
> I realize I can use function overloading to get around this but in my
> case where different objects types may be passed, it would get real ugly.
>
> I notice it is just a warning. Does the compiler still correctly place
> the entire object on the stack?
Probably not....
My guess is you're passing a non-POD class (plain ol' data) through the
va_list...
5.2.2:
When there is no parameter for a given argument ... ,
if the argument ... has a non-POD class type(9), the behavior is
undefined.
9:
A POD-struct is an aggregate class that has no non-static data members of
type pointer to member, non-POD-struct, non-POD-union (or array of such
types) or reference, and has no user-defined copy assignment operator and
no user-defined destructor. Similarly, a POD-union is an aggregate union
that has no non-static data members of type pointer to member,
non-POD-struct, non-POD-union (or array of such types) or reference,
and has no user-defined copy assignment operator and no user-defined
destructor. A POD class is a class that is either a POD-struct or POD-union.
So your code may be broken; if your class exhibits any of the above non-POD
class characteristics, it is. Probably the reason you get the error now
is that egcs is more strict regarding the C++ standard than older versions
of gcc and more than likely, your AIX compiler :)
---
Doug Semler | doug@seaspace.com
SeaSpace Corporation | Garbage In -- Gospel Out
Least Senior Software Developer; | Minister of things to do Next Quarter
Low Man on the Totem Pole | (but will Never Be Done) DNRC O-
A closed mind is a terrible thing | Bus Error (passengers dumped)
-----BEGIN GEEK CODE BLOCK-----
Version: 3.12
GCS/M d---(pu) s++:- a-- C++ UILSH+++$ P--- L++ E--- W+
N++ o-- K? w--(++$) O- M-- V- PS+ !PE Y PGP t(+) 5+++ X+
R- tv+(-) b+(++) DI++++ D G e++>++++ h!>--- r% y+>+++++**
------END GEEK CODE BLOCK------