1 // Copyright (C) 2003 Free Software Foundation, Inc.
2 // Contributed by Nathan Sidwell 30 Jul 2003 <nathan@codesourcery.com>
4 // make sure statement expressions work properly
9 extern "C" int printf (char const *, ...);
10 extern "C" void abort ();
12 static unsigned order[] =
17 7, 107, 8, 408, 9, 109, 108,
18 10, 11, 110, 411, 12, 112, 111,
24 static unsigned point;
26 static void Check (unsigned t, unsigned i, void const *ptr, char const *name)
28 printf ("%d %d %p %s\n", t, i, ptr, name);
30 if (order[point++] != i + t)
34 template <int I> struct A
36 A () { Check (0, I, this, __PRETTY_FUNCTION__); }
37 ~A () { Check (100, I, this, __PRETTY_FUNCTION__); }
38 A (A const &) { Check (200, I, this, __PRETTY_FUNCTION__); }
39 A &operator= (A const &) { Check (300, I, this, __PRETTY_FUNCTION__); }
40 void Foo () const { Check (400, I, this, __PRETTY_FUNCTION__); }
45 ({A<1> (); A<2> (); ;});
46 ({A<3> (), A<4> (); ;});
47 ({A<5> (), A<6> ();});
48 ({A <7> (); A<8> (); }).Foo (), A<9> ();
49 ({A <10> (), A<11> (); }).Foo (), A<12> ();
52 Check (0, 0, 0, "end");