extern char version[];
class C {
public:
C(int);
void g(int a, ...);
static void h(int a, ...);
};
void g(int a, ...);
void t1()
{
C c(10);
g(10, c);
#if __cplusplus <= 199711L
#endif
g(10, version);
void (*ptr)(int, ...) = g;
ptr(10, c);
#if __cplusplus <= 199711L
#endif
ptr(10, version);
}
void t2()
{
C c(10);
c.g(10, c);
#if __cplusplus <= 199711L
#endif
c.g(10, version);
void (C::*ptr)(int, ...) = &C::g;
(c.*ptr)(10, c);
#if __cplusplus <= 199711L
#endif
(c.*ptr)(10, version);
C::h(10, c);
#if __cplusplus <= 199711L
#endif
C::h(10, version);
void (*static_ptr)(int, ...) = &C::h;
static_ptr(10, c);
#if __cplusplus <= 199711L
#endif
static_ptr(10, version);
}
int (^block)(int, ...);
void t3()
{
C c(10);
block(10, c);
#if __cplusplus <= 199711L
#endif
block(10, version);
}
class D {
public:
void operator() (int a, ...);
};
void t4()
{
C c(10);
D d;
d(10, c);
#if __cplusplus <= 199711L
#endif
d(10, version);
}
class E {
E(int, ...); };
void t5()
{
C c(10);
E e(10, c);
#if __cplusplus <= 199711L
#endif
(void)E(10, c);
#if __cplusplus <= 199711L
#endif
}
class Foo {
public:
Foo() {}
};
int Helper(...);
const int size = sizeof(Helper(Foo()));
namespace std {
class type_info { };
}
struct Base { virtual ~Base(); };
Base &get_base(...);
int eat_base(...);
void test_typeid(Base &base) {
(void)typeid(get_base(base));
#if __cplusplus <= 199711L
#else
#endif
(void)typeid(eat_base(base)); }
void t6(Foo somearg, ... ) {
__builtin_va_list list;
__builtin_va_start(list, somearg);
}
void t6b(Foo somearg, ... ) {
__builtin_va_list list;
__builtin_stdarg_start(list, somearg); }
void t7(int n, ...) {
__builtin_va_list list;
__builtin_va_start(list, n);
(void)__builtin_va_arg(list, C); __builtin_va_end(list);
}
struct Abstract {
virtual void doit() = 0; };
void t8(int n, ...) {
__builtin_va_list list;
__builtin_va_start(list, n);
(void)__builtin_va_arg(list, Abstract); __builtin_va_end(list);
}
int t9(int n) {
return (int)sizeof(*(Helper(Foo()), (int (*)[n])0));
#if __cplusplus <= 199711L
#endif
}
namespace t10 {
struct F {
F();
};
struct S {
void operator()(F, ...);
};
void foo() {
S s;
F f;
s.operator()(f);
s(f);
}
}
namespace t11 {
typedef void(*function_ptr)(int, ...);
typedef void(C::*member_ptr)(int, ...);
typedef void(^block_ptr)(int, ...);
function_ptr get_f_ptr();
member_ptr get_m_ptr();
block_ptr get_b_ptr();
function_ptr arr_f_ptr[5];
member_ptr arr_m_ptr[5];
block_ptr arr_b_ptr[5];
void test() {
C c(10);
(get_f_ptr())(10, c);
#if __cplusplus <= 199711L
#endif
(get_f_ptr())(10, version);
(c.*get_m_ptr())(10, c);
#if __cplusplus <= 199711L
#endif
(c.*get_m_ptr())(10, version);
(get_b_ptr())(10, c);
#if __cplusplus <= 199711L
#endif
(get_b_ptr())(10, version);
(arr_f_ptr[3])(10, c);
#if __cplusplus <= 199711L
#endif
(arr_f_ptr[3])(10, version);
(c.*arr_m_ptr[3])(10, c);
#if __cplusplus <= 199711L
#endif
(c.*arr_m_ptr[3])(10, version);
(arr_b_ptr[3])(10, c);
#if __cplusplus <= 199711L
#endif
(arr_b_ptr[3])(10, version);
}
}