I currently don't have time to reduce the issue, so I am posting the full source code: // Writes a numbered table of contents with in-page links of markdown file. import std.stdio : File, writeln; import std.file : readText; import std.ascii : isAlphaNum, isWhite, toLower; import std.algorithm : countUntil, each, filter, find, findSplit, joiner, map, splitter, stripRight; import std.array : replaceLast, replace; import std.range : chain, drop, front, tee; import std.string; import std.conv : to; void main() { enum indent = " "; uint lastLvl = 1; uint lvl = 1; uint titleNum = 1; File("markdown_test.md") .byLine .filter!(line => line.startsWith("#")) .tee!((line) { auto currLvl = countUntil!(ch => ch.isAlphaNum)(line, "#"); titleNum = (currLvl == lastLvl)? titleNum + 1 : 1; lastLvl = cast(uint)currLvl; }) .map!(line => line.stripRight('#')) .map!(line => line.replaceLast("#", titleNum.to!string ~ ".")) .map!(line => line.find(".").drop(1).front.isWhite? line : line.replace(".", ". ")) .map!(line => line.replace("#", indent)) .map!((line) { auto split = line.findSplit(". "); auto escaped = split[2] .filter!(ch => ch.isAlphaNum || ch.isWhite) .map!(ch => ch.toLower) .to!string .strip .splitter!(ch => ch.isWhite) .joiner("-"); return chain( split[0], split[1], "[", split[2].strip, "]", "(#", escaped, ")" ); }) .each!(line => line.writeln); }
When I run DMD with dmd -c this_file.d I get an compile-time error message (which is expected) and then DMD segfaults.
https://github.com/D-Programming-Language/dmd/pull/5265
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/0c8415056e801d414222bc6f2cf7a15e6d2a2c7a fix Issue 15317 - Segfault in Type::kind() with DMD v2.069.0 `TypeExp.semantic` should return `ErrorExp` if the `type` is `Terror`. https://github.com/D-Programming-Language/dmd/commit/2c3a160e10367f4750e06694779e78a9de81be1d Merge pull request #5265 from 9rnsr/fix15317 Issue 15317 - Segfault in Type::kind() with DMD v2.069.0
Commits pushed to stable at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/0c8415056e801d414222bc6f2cf7a15e6d2a2c7a fix Issue 15317 - Segfault in Type::kind() with DMD v2.069.0 https://github.com/D-Programming-Language/dmd/commit/2c3a160e10367f4750e06694779e78a9de81be1d Merge pull request #5265 from 9rnsr/fix15317