[Issue 6785] New: Wrong error message from pragma(msg) of failed instantiation

Don nospam at nospam.com
Sat Oct 8 13:24:15 PDT 2011


On 08.10.2011 00:41, d-bugmail at puremagic.com wrote:
> http://d.puremagic.com/issues/show_bug.cgi?id=6785
>
>             Summary: Wrong error message from pragma(msg) of failed
>                      instantiation
>             Product: D
>             Version: D2
>            Platform: x86
>          OS/Version: Windows
>              Status: NEW
>            Keywords: diagnostic
>            Severity: minor
>            Priority: P2
>           Component: DMD
>          AssignedTo: nobody at puremagic.com
>          ReportedBy: bearophile_hugs at eml.cc
>
>
> --- Comment #0 from bearophile_hugs at eml.cc 2011-10-07 15:41:00 PDT ---
> 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
>

[Replying in the ng, because bugzilla is down]
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

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


More information about the Digitalmars-d-bugs mailing list