Skip to content

Commit

Permalink
Merge branch '2.063' of github.com:D-Programming-Language/dmd into 2.063
Browse files Browse the repository at this point in the history
  • Loading branch information
WalterBright committed Jun 28, 2013
2 parents b69b64c + 97bdd75 commit 121fca6
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/expression.c
Expand Up @@ -12617,16 +12617,20 @@ Expression *EqualExp::semantic(Scope *sc)

BinExp::semanticp(sc);

if (e1->op == TOKtype || e2->op == TOKtype)
return incompatibleTypes();

/* Before checking for operator overloading, check to see if we're
* comparing the addresses of two statics. If so, we can just see
* if they are the same symbol.
*/
if (e1->op == TOKaddress && e2->op == TOKaddress)
{ AddrExp *ae1 = (AddrExp *)e1;
{
AddrExp *ae1 = (AddrExp *)e1;
AddrExp *ae2 = (AddrExp *)e2;

if (ae1->e1->op == TOKvar && ae2->e1->op == TOKvar)
{ VarExp *ve1 = (VarExp *)ae1->e1;
{
VarExp *ve1 = (VarExp *)ae1->e1;
VarExp *ve2 = (VarExp *)ae2->e1;

if (ve1->var == ve2->var /*|| ve1->var->toSymbol() == ve2->var->toSymbol()*/)
Expand Down
17 changes: 17 additions & 0 deletions test/runnable/aliasthis.d
Expand Up @@ -1243,6 +1243,22 @@ void test10004()
assert(count == 2);
}

/***************************************************/
// 10456

void test10456()
{
S10456 s1, s2;
auto x = s1 == s2;
}

struct S10456
{
enum E { e };
alias E this;
int[] x;
}

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

int main()
Expand Down Expand Up @@ -1287,6 +1303,7 @@ int main()
test10178();
test9890();
test10004();
test10456();

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

0 comments on commit 121fca6

Please sign in to comment.