Why is the error message coming by the end of the compilation?

ag0aep6g anonymous at example.com
Sun Apr 15 10:27:26 UTC 2018


On 04/14/2018 08:56 PM, bauss wrote:
> I wish there was a way to give a mixin some kind of identity like:
> 
> mixin("mymixin", "somecode");
> 
> Where an error message would print something like:
> 
> Error in mixin("mymixin"): ...
> 
> That would completely solve this issue and I wouldn't have to have 
> pragma(msg) all over the place.

The `#line` thing might help:

----
void main()
{
     mixin("#line 1 \"mymixin\"\n" ~ "somecode;");
         /* mymixin(1): Error: undefined identifier somecode */
     somecode;
         /* test.d(5): Error: undefined identifier somecode */
}
----

https://dlang.org/spec/lex.html#special-token-sequence


More information about the Digitalmars-d-learn mailing list