const of AliasSeq is silently ignored

Steven Schveighoffer schveiguy at gmail.com
Thu Apr 11 17:32:23 UTC 2019


On 4/8/19 3:56 PM, Yuxuan Shui wrote:
> 
> In this example:
> 
>      const(AliasSeq!(int, int)) a;
>      pragma(msg, typeof(a)); // (int, int)
> 
> This kind of make sense, since AliasSeq is not a "single" type. But 
> silently dropping const seems bad, the compiler should probably report 
> an error/warning in this case?

I agree with you, please file a bug. I would have expected it to be 
const(int), const(int).

I would expect this pattern to always hold, no matter what T is.

T var1;
const(T) var2;

static assert(is(typeof(var2) == const));

-Steve


More information about the Digitalmars-d-learn mailing list