Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions test/compilable/b17712.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// REQUIRED_ARGS: -main
// https://issues.dlang.org/show_bug.cgi?id=17712

struct Bytecode
{
uint data;
}

@trusted ctSub(U)(string format, U args)
{
import std.conv : to;
foreach (i; format)
return format~ to!string(args);
return format;
}

struct CtContext
{
import std.uni : CodepointSet;

CodepointSet[] charsets;

string ctAtomCode(Bytecode[] ir)
{
string code;
switch (code)
{
OrChar:
code ~= ``;
for (uint i ; i ;)
code ~= ctSub(``, ir[i].data);
charsets[ir[0].data].toSourceCode;
break;

default:
assert(0);
}
return code;
}
}
54 changes: 54 additions & 0 deletions test/compilable/b17712_c13.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
// https://issues.dlang.org/show_bug.cgi?id=17712#c13

import std.datetime;
import std.typecons;
import std.variant;


Y a()
{
Y n = Y(Y[].init);

n.get!(X[]);
return n;
}

struct X
{
Y key;
}
struct Y
{
Algebraic!(Y[]) value_;
this(T)(T value)
{
value_ = value;
}
bool opEquals(T)(T rhs) const
{
static if(is(Unqual!T == Y))
{
return true;
}
else
{
return get!(T, No.x) == get!T;
}
}
T get(T, Flag!"x" x = Yes.x)() const
{
return this[""].get!(T, x);
}

Y opIndex(T)(T index) const
{
const X[] pairs;
if(pairs[0].key == index)
{
assert(0);
}
assert(0);
}
}

void main(){}