D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 6785 - Wrong error message from pragma(msg) of failed instantiation
Summary: Wrong error message from pragma(msg) of failed instantiation
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: x86 Windows
: P2 minor
Assignee: No Owner
URL:
Keywords: diagnostic, pull
Depends on:
Blocks:
 
Reported: 2011-10-07 15:41 UTC by bearophile_hugs
Modified: 2012-02-29 19:03 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description bearophile_hugs 2011-10-07 15:41:00 UTC
This is wrong D2 code (there is no foo):


void main() {
    enum int x = 1;
    pragma(msg, foo!x);
}


DMD 2.056head gives a partially wrong error message, that contains a "__error":

test.d(3): Error: template instance foo!(x) template 'foo' is not defined
__error
Comment 1 Don 2011-10-08 13:28:54 UTC
The "__error" isn't part of the error message. It's coming from the pragma(msg): it's printing foo!x, and that's an error, so it prints "__error".

The real bug is that the pragma msg is still displayed, even when an error occurs while evaluating it. Maybe it should give an error of the form:

test.d(3): Error: template instance foo!(x) template 'foo' is not defined
test.d(3): Error: parameter for pragma(msg) must be a string