repo.or.cz
/
official-gcc.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
Daily bump.
[official-gcc.git]
/
gcc
/
testsuite
/
g++.dg
/
ext
/
varargs1.C
blob
b67d788e1b732ebf4cf4e7f33ded5cdc31dad7dd
1
// Test that passing an object with non-trivial copy constructor and
2
// destructor is (conditionally) supported and has sensible semantics.
3
4
#include <stdarg.h>
5
extern "C" void abort();
6
7
void *as[5];
8
int i;
9
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
}
21
};
22
23
void f(int i, ...) {
24
va_list ap;
25
va_start (ap, i);
26
A ar = va_arg (ap, A);
27
}
28
29
int main()
30
{
31
f(42,A());
32
if (i != 0)
33
abort();
34
}