Template argument deduction fails with alias

Ben Jones fake at fake.fake
Tue Sep 1 01:11:35 UTC 2020


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



More information about the Digitalmars-d-learn mailing list