Why is this?

rikki cattermole via Digitalmars-d digitalmars-d at puremagic.com
Mon Sep 5 23:10:09 PDT 2016


On 06/09/2016 6:07 PM, Manu via Digitalmars-d wrote:
> I have weird thing:
>
> template E(F){
>     enum E {
>         K = F(1)
>     }
> }
>
> struct S(F = float, alias e_ = E!double.K) {}
typeof(E!double.K)
> S!float x; // Error: E!double.K is used as a type
>
> alias T = E!double.K;
> struct S2(F = float, alias e_ = T) {}
> S2!float y; // alias makes it okay...
>
> struct S3(F = float, alias e_ = (E!double.K)) {}
> S3!float z; // just putting parens make it okay as well... wat!?
>
>
> This can't be right... right?
>
> No problem if E is not a template.
>



More information about the Digitalmars-d mailing list