* doc/extend.texi (Loop-Specific Pragmas): Document pragma GCC unroll.
[official-gcc.git] / gcc / testsuite / g++.dg / ext / varargs1.C
blobb67d788e1b732ebf4cf4e7f33ded5cdc31dad7dd
1 // Test that passing an object with non-trivial copy constructor and
2 // destructor is (conditionally) supported and has sensible semantics.
4 #include <stdarg.h>
5 extern "C" void abort();
7 void *as[5];
8 int i;
10 struct A {
11   A() { as[i++] = this; }
12   A(const A& a) {
13     if (&a != as[i-1])
14       abort();
15     as[i++] = this;
16   }
17   ~A() {
18     if (this != as[--i])
19       abort();
20   }
23 void f(int i, ...) {
24   va_list ap;
25   va_start (ap, i);
26   A ar = va_arg (ap, A);
29 int main()
31   f(42,A());
32   if (i != 0)
33     abort();