[Issue 15450] New: ICE during CTFE of legit function
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Tue Dec 15 15:00:22 PST 2015
https://issues.dlang.org/show_bug.cgi?id=15450
Issue ID: 15450
Summary: ICE during CTFE of legit function
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: andrei at erdani.com
Repro below fails with:
dmd: interpret.c:1034: Expression* interpret(FuncDeclaration*, InterState*,
Expressions*, Expression*): Assertion `!e || (e->op != TOKcontinue && e->op !=
TOKbreak)' failed.
====================
struct BigO
{
struct Atom
{
int id;
double exp;
double logExp;
}
private Atom[][] terms;
int opCmp(const BigO rhs) const
{
int result = 0;
bigone:
foreach (ref l; terms)
{
foreach (ref r; rhs.terms)
{
if (l == r) continue bigone;
if (smaller(l, r))
{
if (result == 1) return 0;
if (result == 0) result = -1;
continue bigone;
}
if (smaller(r, l))
{
if (result == -1) return 0;
if (result == 0) result = 1;
continue bigone;
}
}
// Not comparable
return 0;
}
return result;
}
private static bool smaller(const(Atom)[] lhs, const(Atom)[] rhs)
{
return 0;
}
}
static immutable
linear = BigO([ [ BigO.Atom(0, 1, 0) ] ]);
static assert(linear >= linear);
--
More information about the Digitalmars-d-bugs
mailing list