Some Nullable-related issue

Denis Feklushkin feklushkin.denis at gmail.com
Fri Dec 21 03:26:30 UTC 2018


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)



More information about the Digitalmars-d mailing list