www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Some Nullable-related issue

reply Denis Feklushkin <feklushkin.denis gmail.com> writes:
Pavel Chebotarev found that this code causes error on DMD:

import std.typecons;

struct Atom
{
     Nullable!long a1;
     Nullable!long a2;
     Nullable!long a3;
     Nullable!long a4;
     Nullable!long a5;
     Nullable!long a6;
     Nullable!long a7;
     Nullable!long a8;
     Nullable!long a9;
     Nullable!long a10;
}

struct Molecule
{
     Nullable!Atom a1;
     Nullable!Atom a2;
     Nullable!Atom a3;
     Nullable!Atom a4;
}

struct Material
{
     Nullable!Molecule u1;
     Nullable!Molecule u2;
     Nullable!Molecule u3;
}

struct House
{
     Nullable!Material m1;
}

dmd bug01.d                                                       
                                                                   
                                         
/usr/include/dmd/phobos/std/traits.d(2810): Error: template 
instance 
`std.traits.RepresentationTypeTuple!(Material).Impl!(Atom, bool, 
bool)` recursive expansion

Probably, LDC is not affected, but currently we can't check this 
(and maybe LDC uses another version of Phobos and this is Phobos 
issue)
Dec 20 2018
parent Tony <tonytdominguez aol.com> writes:
On Friday, 21 December 2018 at 03:26:30 UTC, Denis Feklushkin 
wrote:

                                         
 /usr/include/dmd/phobos/std/traits.d(2810): Error: template 
 instance 
 `std.traits.RepresentationTypeTuple!(Material).Impl!(Atom, 
 bool, bool)` recursive expansion
With gdc 6.3.0 it compiles successfully. This is supposed to correspond to dmd 2.068.2 but compiling with that gives me a long list of linker errors. Using dvm installed DMD: 2.083.0 - same error as you show 2.081.1 - OK 2.076.0 - OK 2.068.2 - link error
Dec 22 2018