diff options
Diffstat (limited to 'gcc/testsuite/g++.dg/cpp0x/rvo.C')
-rw-r--r-- | gcc/testsuite/g++.dg/cpp0x/rvo.C | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/cpp0x/rvo.C b/gcc/testsuite/g++.dg/cpp0x/rvo.C new file mode 100644 index 000000000..d4459af64 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/rvo.C @@ -0,0 +1,25 @@ +// { dg-do run } +// { dg-options "-std=c++0x" } +// Contributed by Sylvain Pion +static int rvalue_constructions = 0; + +struct A { + A () { } + A (const A&) { } + A (A&&) { ++rvalue_constructions; } + ~A () { } +}; + +A f() { return A(); } + +extern "C" { + void abort(void); +} + +int main() +{ + A c = f(); + + if (rvalue_constructions != 0) + abort(); +} |