[llvm-commits] [test-suite] r46498 - /test-suite/trunk/SingleSource/Regression/C++/2008-01-29-ParamAliasesReturn.cpp
Duncan Sands
baldrick at free.fr
Mon Jan 28 22:46:44 PST 2008
Author: baldrick
Date: Tue Jan 29 00:46:44 2008
New Revision: 46498
URL: http://llvm.org/viewvc/llvm-project?rev=46498&view=rev
Log:
Test for PR1942.
Added:
test-suite/trunk/SingleSource/Regression/C++/2008-01-29-ParamAliasesReturn.cpp
Added: test-suite/trunk/SingleSource/Regression/C++/2008-01-29-ParamAliasesReturn.cpp
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/SingleSource/Regression/C%2B%2B/2008-01-29-ParamAliasesReturn.cpp?rev=46498&view=auto
==============================================================================
--- test-suite/trunk/SingleSource/Regression/C++/2008-01-29-ParamAliasesReturn.cpp (added)
+++ test-suite/trunk/SingleSource/Regression/C++/2008-01-29-ParamAliasesReturn.cpp Tue Jan 29 00:46:44 2008
@@ -0,0 +1,38 @@
+#include <stdio.h>
+
+class foo
+{
+public:
+ int a;
+ int b;
+ int c;
+ int d;
+
+ foo(void) : a(0), b(0) {}
+
+ foo(int aa, int bb) : a(aa), b(bb) {}
+
+ const foo operator+(const foo& in) const;
+
+ foo operator+=(const foo& in);
+};
+
+const foo foo::operator+(const foo& in) const {
+ foo Out;
+ Out.a = a + in.a;
+ Out.b = b + in.b;
+ return Out;
+}
+
+foo foo::operator+=(const foo& in) {
+ *this = *this + in;
+ return *this;
+}
+
+int main() {
+ foo x(1, 2);
+ foo y(3, 4);
+ x += y;
+ printf("%d %d\n", x.a, x.b);
+ return 0;
+}
More information about the llvm-commits
mailing list