Hi, I was working on a grammar with Pegged and dmd crashed. I reduced it to:
class ZeroOrMore(Expr)
{
enum name = "ZeroOrMore!("~Expr.name~")";
}
class Range(char begin, char end)
{
enum name = "Range!("~begin~","~end~")";
}
mixin(q{
class RubySource : ZeroOrMore!(DecLiteral)
{
}
class DecLiteral : Range!('0','9')
{
}
});
void main() {
}
I get this error, followed by dmd crashing:
dmd_crash.d(13): Error: class dmd_crash.DecLiteral is forward referenced when looking for 'name'
If RubySource and DecLiteral are entered normally (not as a string mixin), then the code compiles.
I tried reducing it a bit more:
class ZeroOrMore(Expr)
{
enum name = "ZeroOrMore!("~Expr.name~")";
}
mixin(q{
alias ZeroOrMore!(DecLiteral) foo;
class DecLiteral
{
enum name = "Range!("~begin~","~end~")";
}
});
void main() {
}
However, then I get a *large* number of errors:
dmd_crash.d(32): Error: class dmd_crash.DecLiteral is forward referenced when looking for 'name'
dmd_crash.d(32): Error: class dmd_crash.DecLiteral is forward referenced when looking for 'opDot'
dmd_crash.d(32): Error: class dmd_crash.DecLiteral is forward referenced when looking for 'opDispatch'
dmd_crash.d(32): Error: class dmd_crash.DecLiteral is forward referenced when looking for 'ame'
dmd_crash.d(32): Error: class dmd_crash.DecLiteral is forward referenced when looking for 'nme'
dmd_crash.d(32): Error: class dmd_crash.DecLiteral is forward referenced when looking for 'nae'
dmd_crash.d(32): Error: class dmd_crash.DecLiteral is forward referenced when looking for 'nam'
dmd_crash.d(32): Error: class dmd_crash.DecLiteral is forward referenced when looking for 'anme'
...
For thousands of lines. I waited a little while, then killed dmd. Both of these examples are valid code, right?
Comment #1 by k.hara.pg — 2013-11-22T00:27:30Z
(In reply to comment #0)
> Hi, I was working on a grammar with Pegged and dmd crashed. I reduced it to:
>
> class ZeroOrMore(Expr)
> {
> enum name = "ZeroOrMore!("~Expr.name~")";
> }
> class Range(char begin, char end)
> {
> enum name = "Range!("~begin~","~end~")";
> }
> mixin(q{
> class RubySource : ZeroOrMore!(DecLiteral)
> {
> }
> class DecLiteral : Range!('0','9')
> {
> }
> });
> void main() {
> }
>
> I get this error, followed by dmd crashing:
>
> dmd_crash.d(13): Error: class dmd_crash.DecLiteral is forward referenced when
> looking for 'name'
With git head, crash does not occur anymore. However compilation still wrongly fails.
https://github.com/D-Programming-Language/dmd/pull/2853
Comment #2 by github-bugzilla — 2013-11-23T21:34:50Z