Bug 77 – After a compile error occurs, all template instances fail

Status
RESOLVED
Resolution
FIXED
Severity
major
Priority
P2
Component
dmd
Product
D
Version
D1 (retired)
Platform
All
OS
Windows
Creation time
2006-03-31T02:51:00Z
Last change time
2014-02-15T02:08:28Z
Keywords
diagnostic
Assigned to
bugzilla
Creator
clugdbug

Comments

Comment #0 by clugdbug — 2006-03-31T02:51:38Z
This is the simplest example I could come up with. If you swap the order of line(10) and line(11), you just get "undefined identifier b". With the order as written, the correct error is followed by spurious error messages: mar30.d(10): undefined identifier b mar30.d(11): voids have no value mar30.d(11): cannot implicitly convert expression (dog!(int)) of type void to in t And with a real project, thousands of lines of incorrect error messages can be generated by a single typo! In fact, I now encounter this bug every time I get any error message at all. I'd rank it as the most annoying bug in DMD. I consider this severity=major -- I've had to temporarily abandon some of my metaprogramming work because of it. ------- template dog(pig) { const int dog=2; } void main() { int a; a=b; // line (10) a = dog!(int); // line (11) }
Comment #1 by kylefurlong — 2006-03-31T05:20:28Z
[email protected] wrote: > http://d.puremagic.com/bugzilla/show_bug.cgi?id=77 > > Summary: After a compile error occurs, all template instances > fail > Product: D > Version: 0.150 > Platform: All > OS/Version: Windows > Status: NEW > Severity: major > Priority: P2 > Component: DMD > AssignedTo: [email protected] > ReportedBy: [email protected] > > > This is the simplest example I could come up with. If you swap the order of > line(10) and line(11), you just get "undefined identifier b". With the order as > written, the correct error is followed by spurious error messages: > > mar30.d(10): undefined identifier b > mar30.d(11): voids have no value > mar30.d(11): cannot implicitly convert expression (dog!(int)) of type void to > in > t > > And with a real project, thousands of lines of incorrect error messages can be > generated by a single typo! In fact, I now encounter this bug every time I get > any error message at all. I'd rank it as the most annoying bug in DMD. I > consider this severity=major -- I've had to temporarily abandon some of my > metaprogramming work because of it. > > ------- > template dog(pig) { > const int dog=2; > } > > void main() { > int a; > a=b; // line (10) > a = dog!(int); // line (11) > } > > Yeah I we've been talking about this for a while, definitely a must fix.
Comment #2 by kylefurlong — 2006-03-31T21:25:20Z
Walter Bright wrote: > [email protected] wrote: >> And with a real project, thousands of lines of incorrect error >> messages can be >> generated by a single typo! In fact, I now encounter this bug every >> time I get >> any error message at all. I'd rank it as the most annoying bug in DMD. I >> consider this severity=major -- I've had to temporarily abandon some >> of my >> metaprogramming work because of it. > > I actually put this in at your suggestion - you suggested that once > templates had an error, it was pointless to continue trying to expand > them because of a blizzard of cascading errors. I can change it so it > just quits on first template error? This would be very good. Also, on a static assert fail, template expansion should also end.
Comment #3 by clugdbug — 2006-05-29T05:06:35Z
Fixed in 0.158.