Skip to content

Instantly share code, notes, and snippets.

@zorael
Created September 4, 2018 19:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save zorael/f4a5f37a5bccdcb16539cc0c27d8f1f9 to your computer and use it in GitHub Desktop.
Save zorael/f4a5f37a5bccdcb16539cc0c27d8f1f9 to your computer and use it in GitHub Desktop.
gdc internal compiler error
module segfault;
struct Foo {}
struct Bar
{
string configFile;
}
Bar settings;
void meldSettingsFromFile()
{
Foo temp;
settings.configFile.readConfigInto(temp);
}
string[][string] readConfigInto(T)(string configFile, T things)
{
return configFile.applyConfiguration(things);
}
string[][string] applyConfiguration(Range, Things...)(Range, Things things)
{
import std.regex;
string section;
string[][string] invalidEntries;
string line;
switch (line)
{
default:
enum pattern = r"^(?P<entry>\w+)\s+(?P<value>.+)";
auto hits = line.matchFirst(pattern);
thingloop:
foreach (i; things)
{
switch (hits["entry"])
{
continue thingloop;
default:
}
}
}
return invalidEntries;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment