From 97bdd75b81b8ee742be8f40e1a7761919a1a256e Mon Sep 17 00:00:00 2001 From: Hara Kenji Date: Fri, 28 Jun 2013 06:00:09 -0700 Subject: [PATCH] Merge pull request #2255 from hpohl/10456 [REG2.063] fix issue 10456 - struct containing enum X, alias X this and a dynamic array no longer compiles since 2.063 Conflicts: test/runnable/aliasthis.d --- src/expression.c | 10 +++++++--- test/runnable/aliasthis.d | 17 +++++++++++++++++ 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/src/expression.c b/src/expression.c index 3b2a67c96409..62275330cbcf 100644 --- a/src/expression.c +++ b/src/expression.c @@ -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()*/) diff --git a/test/runnable/aliasthis.d b/test/runnable/aliasthis.d index 1d0fefaa0c37..327c47d3b79f 100644 --- a/test/runnable/aliasthis.d +++ b/test/runnable/aliasthis.d @@ -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() @@ -1287,6 +1303,7 @@ int main() test10178(); test9890(); test10004(); + test10456(); printf("Success\n"); return 0;