OSDN Git Service

/cp
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / g++.dg / cpp0x / rvo.C
1 // { dg-do run }
2 // { dg-options "-std=c++0x" }
3 // Contributed by Sylvain Pion
4 static int rvalue_constructions = 0;
5
6 struct A {
7   A ()         { }
8   A (const A&) { }
9   A (A&&)      { ++rvalue_constructions; }
10   ~A ()        { }
11 };
12
13 A f() {  return A(); }
14
15 extern "C" {
16   void abort(void);
17 }
18
19 int main()
20 {
21   A c = f();
22
23   if (rvalue_constructions != 0)
24     abort();
25 }