[dmd-internals] A major root-cause bug

Don Clugston dclugston at googlemail.com
Fri Nov 12 20:16:07 PST 2010


While tracking down an ICE bug, I found this important issue.

5195 Forward references ignore const

Most of the front-end uses the 'type' member of a variable to check,
and assumes that if it's non-null,
it hasn't been forward referenced.
The problem is, if x is declared as  'const int *x' or  'const { int
*x; }' , it has a non-null type member, but it doesn't have the const
yet!
This bogus type is a root of all kinds of evil. It manifests in a
variety of weird ways.
I think that several previously fixed bugs, were just special cases of this one.

Unfortunately fixing this isn't just a one-liner. It requires a minor
structural change, and I'm not sure which approach is the best way of
fixing it.
Essentially, all the qualifiers need to be resolved before any other
semantic analysis takes place.
Walter, can you comment?


More information about the dmd-internals mailing list