diff options
Diffstat (limited to 'gcc/testsuite/g++.old-deja/g++.jason/return.C')
-rw-r--r-- | gcc/testsuite/g++.old-deja/g++.jason/return.C | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.old-deja/g++.jason/return.C b/gcc/testsuite/g++.old-deja/g++.jason/return.C new file mode 100644 index 00000000000..c737a3ea8bd --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/return.C @@ -0,0 +1,21 @@ +// PRMS Id: 5331 +// Bug: the return value of foo is constructed in a temporary and then +// copied into the return slot. This is not necessary. + +int c = 0; + +struct X { + X(int i) { } + X(X const &XX) { c = 1; } + ~X() { } +}; + +const X foo() { + return X(3); +}; + +int main() +{ + foo(); + return c; +} |