On Wed, 28 Nov 2018 at 23:46, Iain Buclaw <[email protected]> wrote:
>
> On Wed, 28 Nov 2018 at 22:32, Johannes Pfau <[email protected]> wrote:
> >
> > Next version, addresses the review comments.
> >
> > Tested at https://github.com/D-Programming-GDC/GDC/pull/768
> > ---
> > gcc/d/ChangeLog:
> >
> > 2018-11-28 Johannes Pfau <[email protected]>
> >
> > * expr.cc (ExprVisitor::visit(IdentityExp)): Add support for
> > complex types.
> > (build_float_identity): New function.
> >
> > gcc/testsuite/ChangeLog:
> >
> > 2018-11-28 Johannes Pfau <[email protected]>
> >
> > * gdc.dg/runnable.d: Test IdentityExp for complex types.
> >
> >
> > gcc/d/expr.cc | 40 ++++++++++++++++++++++++---------
> > gcc/testsuite/gdc.dg/runnable.d | 22 ++++++++++++++++++
> > 2 files changed, 51 insertions(+), 11 deletions(-)
> >
>
> As I've said before, looks reasonable to me. Thanks.
>
I noticed that this hasn't been pushed in yet, I was about to go ahead
and commit it, however... there's another case to consider, structs
with creal fields.
This test - modified from your patch - is another that should pass but
currently doesn't.
---
struct CReal
{
creal value;
}
CReal s1 = CReal(+0.0 + 0.0i);
CReal s2 = CReal(+0.0 - 0.0i);
CReal s3 = CReal(-0.0 + 0.0i);
CReal s4 = CReal(+0.0 + 0.0i);
assert(s1 !is s2);
assert(s1 !is s3);
assert(s2 !is s3);
assert(s1 is s4);
assert(!(s1 is s2));
assert(!(s1 is s3));
assert(!(s2 is s3));
assert(!(s1 !is s4));
---
I'll send a supplementary patch, and commit both together.
--
Iain