[Issue 20913] Array "forward reference" error

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Jun 13 10:46:58 UTC 2020


https://issues.dlang.org/show_bug.cgi?id=20913

Basile-z <b2.temp at gmx.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |rejects-valid
                 CC|                            |b2.temp at gmx.com
           Hardware|x86_64                      |All
                 OS|Linux                       |All

--- Comment #1 from Basile-z <b2.temp at gmx.com> ---
Somewhat reduced:

---
import std.traits;

struct Array(T)
{
    static if (hasIndirections!T) {}
}

struct Foo { Array!Bar _barA; }
struct Bar { Frop _frop; }
class Frop { Array!Foo _foos; }
---

The problem is caused by the call to `hasIndirections` and to a nested call to
`isDynamicArray`.

changing the `isDynamiArray` implementation from:

  enum bool isDynamicArray(T) = is(DynamicArrayTypeOf!T) && !isAggregateType!T;

to

  enum isDynamicArray(T) = !isAggregateType!T && is(DynamicArrayTypeOf!T);


allows to compile without error but without really fixing the root of the
problem, which seems to reside in `DynamicArrayTypeOf`.

--


More information about the Digitalmars-d-bugs mailing list