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

D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 77 - After a compile error occurs, all template instances fail
Summary: After a compile error occurs, all template instances fail
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D1 (retired)
Hardware: All Windows
: P2 major
Assignee: Walter Bright
URL:
Keywords: diagnostic
Depends on:
Blocks:
Reported: 2006年03月31日 02:51 UTC by Don
Modified: 2014年02月15日 02:08 UTC (History)
1 user (show)

See Also:


Attachments
Add an attachment (proposed patch, testcase, etc.)

Note You need to log in before you can comment on or make changes to this issue.
Description Don 2006年03月31日 02:51:38 UTC
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 Kyle Furlong 2006年03月31日 05:20:28 UTC
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.
Comment 2 Kyle Furlong 2006年03月31日 21:25:20 UTC
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.
Comment 3 Don 2006年05月29日 05:06:35 UTC
Fixed in 0.158.


AltStyle によって変換されたページ (->オリジナル) /