]> gcc.gnu.org Git - gcc.git/blob - gcc/testsuite/g++.old-deja/g++.other/empty1.C
a876ce84a9f14389ed3eb588b4625d30e751f426
[gcc.git] / gcc / testsuite / g++.old-deja / g++.other / empty1.C
1 // Origin: Mark Mitchell <mark@codesourcery.com>
2 // This test case checks that the return value optimization works for
3 // empty classes.
4
5 // xfailed because empty classes clobbering what they overlay as the
6 // backend treats them as single byte objects. See bug 4222
7 // execution test - XFAIL *-*-*
8
9 extern "C" void abort();
10 extern "C" int printf (const char *, ...);
11
12 int i;
13
14 struct A;
15
16 struct A* as[10];
17
18 struct A {
19 A () { as[i++] = this; }
20 A (const A&) { as[i++] = this; }
21 ~A() { if (i == 0 || as[--i] != this) abort(); }
22 };
23
24 A f() { return A(); }
25
26 int main ()
27 {
28 A a (f ());
29 }
This page took 0.036789 seconds and 4 git commands to generate.