re PR middle-end/71387 (ICE in emit_move_insn, at expr.c:3418 with -Og)
[platform/upstream/gcc.git] / gcc / testsuite / g++.dg / cpp0x / rvo.C
1 // { dg-do run { target c++11 } }
2 // Contributed by Sylvain Pion
3 static int rvalue_constructions = 0;
4
5 struct A {
6   A ()         { }
7   A (const A&) { }
8   A (A&&)      { ++rvalue_constructions; }
9   ~A ()        { }
10 };
11
12 A f() {  return A(); }
13
14 extern "C" {
15   void abort(void);
16 }
17
18 int main()
19 {
20   A c = f();
21
22   if (rvalue_constructions != 0)
23     abort();
24 }