Two special cases of the va_start usage and one special case of va_arg usage are not currently supported.Define class string as follows:
class String1 {
public:
String1 (const String1 &);
...
};
class String2 {
...
};
Note that String1 has a copy constructor, and String2 could be any class. The following two cases of va_start are not supported:
<any type> foo1(const String1 last_parameter_with_known_type, ...)
{
va_list arg_list;
va_start(arg_list, last_parameter_with_known_type);
...
}
<any type> foo2(const String2 &last_parameter_with_known_type, ...)
{
va_list arg_list;
va_start(arg_list, last_parameter_with_known_type);
...
}
va_start calls are not supported if:
- Last parameter with known type is an object of class with default copy constructor (the constructor is called to create a copy of object to pass the copy to function foo1).
- Last parameter with known type is an object passed by reference.
The following case of va_arg usage is not supported (see the previous String1 definition):
<any type> foo3(<any type> last_parameter_with_known_type, ...)
<any type> foo4( )
{
String1 q;
foo3(last_parameter_with_known_type, q);
}
The passing of an object of class with default copy constructor in the "..." part of parameters is not supported.
It does not matter in the previous example if q is a local, global, or temporary variable.
The fourth case is not supported with object passed by reference in "...", because there are no language-supported ways to do that. The only proposed workaround is to change specifications of foo1, foo2, foo3, and so on to those ones that accept pointers to objects instead.