Skip to content

Commit

Permalink
Merge pull request #225 from yebblies/issue6267
Browse files Browse the repository at this point in the history
Issue 6267 - Can't increment alias this'd struct from ref return
  • Loading branch information
WalterBright committed Jul 10, 2011
2 parents 27b73cb + d67490e commit 5f6f697
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/opover.c
Expand Up @@ -474,11 +474,9 @@ Expression *BinExp::op_overload(Scope *sc)

Objects *targsi = NULL;
#if DMDV2
if (!s && !s_r && op != TOKequal && op != TOKnotequal && op != TOKassign)
if (!s && !s_r && op != TOKequal && op != TOKnotequal && op != TOKassign &&
op != TOKplusplus && op != TOKminusminus)
{
if (op == TOKplusplus || op == TOKminusminus)
return NULL;

/* Try the new D2 scheme, opBinary and opBinaryRight
*/
if (ad1)
Expand Down
13 changes: 13 additions & 0 deletions test/runnable/aliasthis.d
Expand Up @@ -103,12 +103,25 @@ void test4()

/**********************************************/

void test5()
{
static struct Double1 {
double val = 1;
alias val this;
}
static Double1 x() { return Double1(); }
x()++;
}

/**********************************************/

int main()
{
test1();
test2();
test3();
test4();
test5();

printf("Success\n");
return 0;
Expand Down

0 comments on commit 5f6f697

Please sign in to comment.