Unqual doesn't remove qualifiers from pointers

John Colvin john.loughran.colvin at gmail.com
Tue Nov 20 17:58:05 UTC 2018


On Tuesday, 20 November 2018 at 17:44:02 UTC, John Chapman wrote:
> Is std.traits.Unqual supposed to work on pointers?
>
> const int x;
> static assert(Unqual!(typeof(&x)) == int*);
>
> Compiler says: static assert:  `is(const(int)* == int*)` is 
> false
>
> If it's a bug I'll report it.

No. Unqual only strips from a type, not from any other types 
contained in that type.

I.e.
Unqual!string == string
Unqual!const(int*) == const(int)*
Unqual!const(int)* == const(int)*
struct S { const int a; }
typeof(Unqual!(const(S)).a) == const int
typeof(Unqual!(S.a) == const int

Please make a bug report to improve the documentation (and PR as 
well if you like :) )


More information about the Digitalmars-d mailing list