[Issue 21614] compiled imports: core.exception.AssertError at src/dmd/semantic3.d(812): Assertion failure
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sat Feb 6 17:23:38 UTC 2021
https://issues.dlang.org/show_bug.cgi?id=21614
Iain Buclaw <ibuclaw at gdcproject.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Attachment #1816|0 |1
is obsolete| |
--- Comment #3 from Iain Buclaw <ibuclaw at gdcproject.org> ---
Created attachment 1817
--> https://issues.dlang.org/attachment.cgi?id=1817&action=edit
reduced test without errors
Attached reduced test that hits the assert error without any compiler errors.
issue21614.d
---
real logmdigammaInverse(real y)
{
import imports.issue21614.numeric;
findRoot(1, y, 2);
return y;
}
---
imports/issue21614/numeric.d
---
module imports.issue21614.numeric;
import imports.issue21614.typecons;
T findRoot(T, DF, DT)(DF f, T a, T b, DT tolerance)
{
immutable r = findRoot(f, a, b, a, b, tolerance);
return r[2];
}
T findRoot(T, DF)(DF f, T a, T b)
{
return findRoot(f, a, b, false);
}
Tuple!(T, T, R) findRoot(T, R, DF, DT)(DF, T, T, R, R, DT)
{
return Tuple!(T, T, R)();
}
---
imports/issue21614/typecons.d
---
module imports.issue21614.typecons;
template AliasSeq(TList...)
{
alias AliasSeq = TList;
}
template staticMap(alias F, T...)
{
static if (T.length == 1)
alias staticMap = AliasSeq!(F!T);
else
alias staticMap = AliasSeq!(staticMap!(F, T[0]), staticMap!(F, T[$/2 ..
$]));
}
uint formattedWrite(Writer, Char)(Writer , Char)
{
auto spec = FormatSpec!Char();
return 0;
}
struct FormatSpec(Char)
{
import imports.issue21614.typecons;
}
template ElementEncodingType(R)
{
static if (is(R : E[], E))
alias ElementEncodingType = E;
}
struct Appender(A)
{
inout(ElementEncodingType!A)[] data()
{
return [];
}
}
Appender!A appender(A)()
{
return Appender!A();
}
immutable(Char)[] format(Char, Args...)(Char[] fmt)
{
auto w = appender!(Char[]);
formattedWrite(w, fmt);
return w.data;
}
template Tuple(Specs...)
{
template parseSpecs(Specs...)
{
static if (Specs.length == 0)
alias parseSpecs = AliasSeq!();
static if (is(Specs[0]))
alias parseSpecs = AliasSeq!(FieldSpec!(Specs[0]),
parseSpecs!(Specs[1 .. $]));
}
template FieldSpec(T, string s = "")
{
alias Type = T;
alias name = s;
}
alias fieldSpecs = parseSpecs!Specs;
alias extractType(alias spec) = spec.Type;
alias extractName(alias spec) = spec.name;
string injectNamedFields()
{
string decl;
foreach (i; staticMap!(extractName, fieldSpecs))
format(i);
return decl;
}
struct Tuple
{
alias Types = staticMap!(extractType, fieldSpecs);
Types expand;
mixin(injectNamedFields);
alias expand this;
this(Types)
{
}
}
}
---
--
More information about the Digitalmars-d-bugs
mailing list