Unqual doesn't remove qualifiers from pointers

Stanislav Blinov stanislav.blinov at gmail.com
Tue Nov 20 17:55:24 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.

It does work on pointers:

static assert(is(Unqual!(const(int*)) == const(int)*));

Technically there's nothing to Unqual from that typeof(&x): it's 
already a const(int)*, i.e. a mutable pointer. But it'd be nice 
to have some "strip'em all" equivalent.


More information about the Digitalmars-d mailing list