diff options
author | Jason Merrill <jason@gcc.gnu.org> | 2002-01-18 08:24:04 -0500 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2002-01-18 08:24:04 -0500 |
commit | cc0723165e7aa03d4f07f542452ca7cbb7912d69 (patch) | |
tree | 8e2666d4d01ea9ec07062b8776ff1f845ba6bac6 | |
parent | 4ffbff5906ce6291c39852f0856b5f6a60a3d3e1 (diff) | |
download | gcc-cc0723165e7aa03d4f07f542452ca7cbb7912d69.zip gcc-cc0723165e7aa03d4f07f542452ca7cbb7912d69.tar.gz gcc-cc0723165e7aa03d4f07f542452ca7cbb7912d69.tar.bz2 |
also test with inlining
From-SVN: r48984
-rw-r--r-- | gcc/testsuite/g++.dg/opt/nrv2.C | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/opt/nrv2.C b/gcc/testsuite/g++.dg/opt/nrv2.C new file mode 100644 index 0000000..4ffc075 --- /dev/null +++ b/gcc/testsuite/g++.dg/opt/nrv2.C @@ -0,0 +1,28 @@ +// Test for the named return value optimization, this time with inlining. +// { dg-do run } +// { dg-options -O2 } + +int c; +int d; + +struct A +{ + A() { ++c; } + A(const A&) { ++c; }; + ~A() { ++d; } +}; + +inline A f () +{ + A a; + return a; +} + +int main () +{ + { + A a = f (); + } + + return !(c == 1 && c == d); +} |