2 changes: 1 addition & 1 deletion test/fail_compilation/fail39.d
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
TEST_OUTPUT:
---
fail_compilation/fail39.d(11): Error: function fail39.main.__funcliteral2 cannot access frame of function D main
fail_compilation/fail39.d(11): Error: function fail39.main.foo is a nested function and cannot be accessed from fail39.main.__funcliteral2
---
*/

Expand Down
28 changes: 28 additions & 0 deletions test/fail_compilation/ice14923.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
TEST_OUTPUT:
---
fail_compilation/ice14923.d(21): Error: function ice14923.parse (C a) is not callable using argument types (A)
fail_compilation/ice14923.d(21): instantiated from here: bar!((b) => parse(b))
---
*/

auto bar(alias fun)()
{
size_t counter;
scope(exit) counter++;

Object a2;
if (auto ai = cast(A)a2) return fun(ai);
if (auto ai = cast(B)a2) return fun(ai);
}

void parse(C a)
{
bar!(b => parse(b))();
}

class A {}

class C {}

class B : C {}
95 changes: 95 additions & 0 deletions test/fail_compilation/ice14929.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
/*
TEST_OUTPUT:
---
fail_compilation/ice14929.d(44): Error: cast(Node)(*this.current).items[this.index] is not an lvalue
fail_compilation/ice14929.d(87): Error: template instance ice14929.HashMap!(ulong, int).HashMap.opBinaryRight!"in" error instantiating
fail_compilation/ice14929.d(91): instantiated from here: HashmapComponentStorage!int
fail_compilation/ice14929.d(91): Error: template instance ice14929.isComponentStorage!(HashmapComponentStorage!int, int) error instantiating
---
*/

struct HashMap(K, V)
{
V* opBinaryRight(string op)(K key) const if (op == "in")
{
size_t index;
foreach (ref node; buckets[index].range)
{
return &(node.value);
}
return null;
}

struct Node
{
K key;
V value;
}

alias Bucket = UnrolledList!(Node);
Bucket[] buckets;
}

struct UnrolledList(T)
{
Range range() const pure
{
return Range(_front);
}

static struct Range
{
ref T front() const @property
{
return cast(T) current.items[index];
}
void popFront() pure
{
}
bool empty() const pure @property
{
return true;
}
const(Node)* current;
size_t index;
}

Node* _front;

static struct Node
{
ContainerStorageType!T[10] items;
}
}

template ContainerStorageType(T)
{
alias ContainerStorageType = T;
}

template isComponentStorage(CS, C)
{
enum bool isComponentStorage = is(typeof(
(inout int = 0)
{
CS cs = CS.init;
ulong eid;
cs.add(eid, c);
}));
}

struct HashmapComponentStorage(ComponentType)
{
private HashMap!(ulong, ComponentType) components;

void add(ulong eid, ComponentType component)
{
assert(eid !in components);
}
}

static assert(isComponentStorage!(HashmapComponentStorage!int, int));

void main()
{
}