Error: template instance `Reflect!(type)` cannot use local `type` as parameter to non-global template `Reflect(Ts...)()`

Paul Backus snarwin at gmail.com
Sun Apr 7 14:37:54 UTC 2019


On 4/7/19 1:30 AM, Nicholas Wilson wrote:
> On Sunday, 7 April 2019 at 05:24:38 UTC, Alex wrote:
>> Error: template instance `Reflect!(type)` cannot use local `type` as
>> parameter to non-global template `Reflect(Ts...)()`
>>
>> mixin(`import `~moduleName!(T)~`;`);   
>> mixin(`alias X = T.`~name~`;`);           
>> super.Reflect!(X);
>>
>> I realize X is local but I'm trying to figure out why it can't be
>> passed to a "non-global" template.
> 
> See
> https://blog.thecybershadow.net/2015/04/28/the-amazing-template-that-does-nothing/
> 
> 
> TL;DR
> 
> At global scope
> alias Identity(alias X) = X;
> 
> then where the error is issued from use `Identity!(type)` instead of type.

This template is actually in Phobos now, as `std.meta.Alias`.


More information about the Digitalmars-d-learn mailing list