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) }
d-bugmail@puremagic.com 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: bugzilla@digitalmars.com > ReportedBy: clugdbug@yahoo.com.au > > > 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.
Walter Bright wrote: > d-bugmail@puremagic.com 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.
Fixed in 0.158.
AltStyle によって変換されたページ (->オリジナル) / アドレス: モード: デフォルト 音声ブラウザ ルビ付き 配色反転 文字拡大 モバイル