Bug 6785 – Wrong error message from pragma(msg) of failed instantiation
Status
RESOLVED
Resolution
FIXED
Severity
minor
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2011-10-07T15:41:00Z
Last change time
2012-02-29T19:03:14Z
Keywords
diagnostic, pull
Assigned to
nobody
Creator
bearophile_hugs
Comments
Comment #0 by bearophile_hugs — 2011-10-07T15:41:00Z
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 by clugdbug — 2011-10-08T13:28:54Z
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