projects
/
gcc.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
4ffbff5
)
also test with inlining
author
Jason Merrill
<jason@gcc.gnu.org>
Fri, 18 Jan 2002 13:24:04 +0000
(08:24 -0500)
committer
Jason Merrill
<jason@gcc.gnu.org>
Fri, 18 Jan 2002 13:24:04 +0000
(08:24 -0500)
From-SVN: r48984
gcc/testsuite/g++.dg/opt/nrv2.C
[new file with mode: 0644]
patch
|
blob
diff --git a/gcc/testsuite/g++.dg/opt/nrv2.C
b/gcc/testsuite/g++.dg/opt/nrv2.C
new file mode 100644
(file)
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);
+}