Unqual doesn't remove qualifiers from pointers

Eugene Wissner belka at caraus.de
Tue Nov 20 17:56:01 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.

Unqual removes qualifies only from the pointer itself, not the 
type pointed by it. It is not a bug. You can use PointerTarget 
with Unqual to remove the qualifiers from the target type:

static assert(is(Unqual!(PointerTarget!(typeof(&x)))* == int*));


More information about the Digitalmars-d mailing list