xxxxxxxxxx
import std.stdio, std.traits;
struct TreeItemChildren(T){}
struct TreeItemSiblings(T){}
class Foo
{
alias TreeItemType = typeof(this);
TreeItemSiblings!TreeItemType _siblings; // remove this decl
TreeItemChildren!TreeItemType _children; // or this one : OK
}
template Bug(T)
{
bool check()
{
bool result;
import std.meta: aliasSeqOf;
import std.range: iota;
foreach(i; aliasSeqOf!(iota(0, T.tupleof.length)))
{
alias MT = typeof(T.tupleof[i]);
static if (is(MT == struct))
result |= Bug!MT; // result = result | ... : OK
if (result) break; // remove this line : OK
}
return result;
}
enum Bug = check();
}
void main()
{
assert(!Bug!Foo);
}