Skip to content

Commit

Permalink
Test for PR1942.
Browse files Browse the repository at this point in the history
llvm-svn: 46498
  • Loading branch information
CunningBaldrick committed Jan 29, 2008
1 parent 92ebbe4 commit c05d515
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions SingleSource/Regression/C++/2008-01-29-ParamAliasesReturn.cpp
Original file line number Diff line number Diff line change
@@ -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;
}

0 comments on commit c05d515

Please sign in to comment.