Template argument deduction fails with alias

Steven Schveighoffer schveiguy at gmail.com
Tue Sep 1 01:22:48 UTC 2020


On 8/31/20 9:11 PM, Ben Jones wrote:
> I have an alias that looks like
> 
> static if(...){
>    alias AliasType = SumType!(...);
> }
> 
> which I use in a template constraint for a function template:
> 
> bool func(T: AliasType!Args, Args...)(T t){ ... }
> 
> 
> When I try to call func with an AliasType object, the argument deduction 
> fails with a message saying that the argument type (a SumType) doesn't 
> match the template constraint (an AliasType)
> 
> Things do work if I change the template constraint to be a SumType 
> rather an an AliasType
> 
> Is there a workaround to this?  Here's a complete example: 
> https://run.dlang.io/is/buRGTs
> 

Very old enhancement request (I doubt this will ever happen): 
https://issues.dlang.org/show_bug.cgi?id=1807

-Steve


More information about the Digitalmars-d-learn mailing list